Slope Calculator

Find the slope between two points, the line equation y = mx + b, intercepts, angle, distance, midpoint and grade, with every step shown.

Loading calculator...

Slope calculator in short
On this page

How to use the slope calculator

1

Enter point 1

Type x₁ and y₁, the coordinates of the first point.

2

Enter point 2

Type x₂ and y₂ for the second point.

3

Read the slope

The slope appears as a fraction where possible, with its decimal value and the line equation.

4

Use the extras

See the intercepts, angle, distance, midpoint and grade without extra work.

How slope is calculated

Slope formula

m = (y₂ − y₁) ÷ (x₂ − x₁) = rise ÷ run

If x₂ = x₁ the run is 0 and the slope is undefined (a vertical line).

Line equation and extras

b = y₁ − m × x₁, so y = mx + b

Distance = √((x₂ − x₁)² + (y₂ − y₁)²)

Midpoint = ((x₁ + x₂) ÷ 2, (y₁ + y₂) ÷ 2)

Angle = arctan(m), Grade = m × 100%

Example 1: points (1, 2) and (4, 8)

A line rising from left to right.

  • Rise and run 8 − 2 = 6, 4 − 1 = 3
  • Slope 6 ÷ 3 = 2
  • Equation y = 2x
  • Distance 6.708204
  • Midpoint (2.5, 5)
  • Angle 63.4349°

A slope of 2 means y goes up 2 units for every 1 unit you move right.

Example 2: points (1, 5) and (3, 1)

A falling line.

  • Slope (1 − 5) ÷ (3 − 1) = −2
  • y-intercept 5 − (−2 × 1) = 7
  • Equation y = −2x + 7
  • x-intercept 3.5

A perpendicular line would have slope 0.5, the negative reciprocal of −2.

Example 3: a fractional slope

Points (0, 0) and (3, 2).

  • Slope 2/3 (0.666667)
  • Equation y = (2/3)x
  • Angle 33.6901°
  • Grade 66.67%

The calculator keeps the slope as an exact fraction when both rise and run are whole numbers.

Where a slope calculator helps

Algebra homework

Find slope, write y = mx + b and check graph questions with the working shown.

Ramps and roofs

Turn rise and run into an angle or percent grade for ramps, roofs and driveways.

Roads and trails

Express a hill’s steepness as a grade for cycling, hiking or road design.

Data trends

Find the rate of change between two data points, such as sales between two months.

Related tools

The distance between the points uses the same idea as the Pythagorean theorem calculator. Simplify a fractional slope with the fraction calculator, or solve where a curve crosses the x-axis with the quadratic formula calculator.

Slope calculator FAQ

Slope measures steepness: how much y changes for each one-unit change in x. It is rise divided by run.

The line goes down from left to right. As x increases, y decreases.

A vertical line has the same x for both points, so the run is 0. Dividing by 0 is undefined, so the line has no slope.

A horizontal line has the same y for both points. The rise is 0, so the slope is 0 and the equation is y = constant.

Take the negative reciprocal. If one line has slope 2, a perpendicular line has slope −1/2.

Angle = arctan(slope), and grade = slope × 100%. A slope of 1 is a 45° angle or a 100% grade.

Embed this calculator on your website

Free to use on any site. Copy the code below and paste it into an HTML block on your page. Please keep the credit link under the calculator.

Show the embed code

Works with WordPress, Wix, Squarespace, Webflow and most site builders that allow HTML. How embedding works.

Estimates, not advice

PureCalculate’s calculators give estimates for planning and education. They aren’t financial, tax or legal advice. Fees and tax rules change, so check the official source before making a decision. Spotted a mistake? Please tell us through the contact page.

Scroll to Top