X-Calculator
Math Updated November 23, 2026

Slope Calculator

Enter two points to get the slope, line equation, angle, distance and midpoint with steps.

Point 1 – x₁
Point 1 – y₁
Point 2 – x₂
Point 2 – y₂
Advertisement
Advertisement

This slope calculator finds the slope of the line through two points and everything that follows from it: the equation of the line in slope-intercept, point-slope and standard form, the y-intercept, the angle of inclination, the distance between the points and the midpoint. Enter (x₁, y₁) and (x₂, y₂) and you get the slope as a fraction and a decimal, with every step shown.

The slope formula

Slope measures how steep a line is: how much y changes for every 1-unit change in x. It is “rise over run”:

m = (y₂ − y₁) ÷ (x₂ − x₁) = Δy ÷ Δx
b = y₁ − m · x₁            (y-intercept)
y = mx + b                  (slope-intercept form)
θ = arctan(m)               (angle with the x-axis)
d = √((x₂ − x₁)² + (y₂ − y₁)²)
midpoint = ((x₁ + x₂) ÷ 2, (y₁ + y₂) ÷ 2)

It does not matter which point you call “point 1”, as long as you subtract in the same order on the top and the bottom.

Worked examples

  • The default, (−2, 1) and (4, 4): rise = 4 − 1 = 3, run = 4 − (−2) = 6, so m = 3/6 = 1/2 = 0.5. Then b = 1 − 0.5 × (−2) = 2, and the line is y = 0.5x + 2. The angle is arctan(0.5) = 26.5651°, the distance is √45 = 3√5 ≈ 6.708204, and the midpoint is (1, 2.5).
  • A falling line, (0, 0) and (3, −4): m = −4/3 ≈ −1.333333, so y = −1.333333x. The distance is exactly 5 (a 3-4-5 right triangle) and the angle is −53.1301°.
  • Decimals, (1.5, 2) and (3.5, 7): m = 5 ÷ 2 = 2.5 and b = 2 − 2.5 × 1.5 = −1.75, giving y = 2.5x − 1.75.
  • Vertical line, (1, 1) and (1, 5): the run is 0, so the slope is undefined and the line is x = 1.
  • Horizontal line, (2, 5) and (6, 5): the rise is 0, so the slope is 0 and the line is y = 5.
Advertisement
Advertisement

Reading the sign and size of a slope

Slope Line direction Angle Example
m > 0 Rises left to right 0° to 90° m = 0.5: up 1 for every 2 across
m < 0 Falls left to right 0° to −90° m = −4/3: down 4 for every 3 across
m = 0 Horizontal 0° y = 5
Undefined Vertical 90° x = 1
m = 1 Diagonal 45° y = x

Two lines are parallel when their slopes are equal and perpendicular when their slopes multiply to −1. A line perpendicular to y = 0.5x + 2 has slope −2.

Slope as a percent grade and an angle

Multiply the slope by 100 to get a percent grade, the form used for roads, ramps and roofs: a slope of 0.5 is a 50% grade, and the 1:12 slope required for wheelchair ramps under the ADA is 8.33%. The angle comes from the arctangent: 50% is 26.57°, while 100% is 45°, not 90°. For construction rise-and-run problems with pitch and degrees, use the rise over run slope calculator or the roof pitch calculator.

Three forms of a line equation

The same line can be written several ways. Slope-intercept form y = mx + b is best for graphing. Point-slope form y − y₁ = m(x − x₁) is fastest to write when you know a point. Standard form Ax + By = C uses whole numbers, which makes it easy to find both intercepts. For the default points, the line is y = 0.5x + 2, y − 1 = 1/2(x + 2), and x − 2y = −4. Setting y = 0 in standard form gives the x-intercept, x = −4; setting x = 0 gives the y-intercept, y = 2.

Where slope shows up

Slope is a rate of change, so it appears whenever one quantity depends on another. On a distance–time graph, the slope is speed: (0 h, 0 mi) to (2 h, 130 mi) gives 65 mph. On a cost chart, it is the price per unit: 10 shirts for $85 and 25 shirts for $175 means each extra shirt costs (175 − 85) ÷ 15 = $6, and the intercept, $25, is the fixed setup fee. In statistics, the slope of a trend line tells you how much y changes on average per unit of x.

Common mistakes

  • Mixing the order of subtraction: (y₂ − y₁) ÷ (x₁ − x₂) flips the sign.
  • Putting run over rise: slope is change in y divided by change in x, never the reverse.
  • Dropping negative signs: subtracting a negative coordinate adds, as in 4 − (−2) = 6.
  • Calling a vertical slope zero: horizontal lines have slope 0; vertical lines have no slope at all.

Frequently Asked Questions

How do you find the slope from two points?

Subtract the y-values and divide by the difference of the x-values in the same order: m = (y₂ − y₁) ÷ (x₂ − x₁). For (−2, 1) and (4, 4), m = 3 ÷ 6 = 0.5.

What is the slope of a vertical line?

It is undefined, because the run x₂ − x₁ is zero and you cannot divide by zero. The equation of a vertical line is x = constant.

How do I convert slope to degrees?

Take the arctangent: θ = arctan(m). A slope of 1 is 45°, a slope of 0.5 is 26.57°, and a slope of 2 is 63.43°.

How do I find the y-intercept from the slope and a point?

Use b = y₁ − m · x₁. With m = 0.5 and the point (−2, 1), b = 1 − 0.5 × (−2) = 2.

What does a negative slope mean?

The line falls as you move to the right: y decreases when x increases. A slope of −2 means y drops 2 units for each unit of x.

Advertisement
Advertisement
Related

You may also need

All Math Calculators
Advertisement