Slope Calculator

Find the slope between two points with steps: rise over run, line equation, angle, distance and midpoint. Free slope calculator.

A slope calculator finds the steepness of a line from two points. Enter x1, y1, x2 and y2 and it returns the slope as a decimal and a fraction, the line equation in slope-intercept form, the angle of the line, the distance between the points and the midpoint, with the steps shown.

Slope is rise over run, written (y2 − y1) ÷ (x2 − x1). If your line is given as Ax + By = C, the standard form to slope-intercept form calculator converts it directly.

This calculator needs JavaScript. Please enable it in your browser.

How the slope calculator works

The slope formula

m = (y2 − y1) ÷ (x2 − x1)

Where:

  • m = the slope of the line
  • (x1, y1) = the first point
  • (x2, y2) = the second point
  • y2 − y1 = the rise (vertical change)
  • x2 − x1 = the run (horizontal change)

Reading the sign of the slope

  • A positive slope means the line rises from left to right.
  • A negative slope means the line falls from left to right.
  • A slope of 0 means the line is horizontal.
  • An undefined slope means the line is vertical, because the run is 0.

What a slope of 1 means

A slope of 1 means the rise equals the run, so the line climbs one unit for every unit it moves right. Its angle with the x-axis is 45 degrees.

The line equation

Once you have the slope, the y-intercept comes from either point.

b = y1 − m × x1
y = mx + b

Worked examples

Example 1: Points (1, 2) and (5, 10)

m = (10 − 2) ÷ (5 − 1) = 8 ÷ 4 = 2
b = 2 − 2 × 1 = 0

The line is y = 2x. The angle with the x-axis is about 63.43 degrees, the distance between the points is √(4² + 8²) = √80 ≈ 8.944, and the midpoint is (3, 6).

Example 2: A falling line, points (−2, 3) and (4, −3)

m = (−3 − 3) ÷ (4 − (−2)) = −6 ÷ 6 = −1
b = 3 − (−1) × (−2) = 1

The line is y = −x + 1. The angle is −45 degrees and the midpoint is (1, 0).

Example 3: A fractional slope, points (0, 1) and (3, 3)

m = (3 − 1) ÷ (3 − 0) = 2 ÷ 3 ≈ 0.6667

The slope is 2/3 and the line is y = (2/3)x + 1. The angle is about 33.69 degrees.

Example 4: A vertical line, points (2, 1) and (2, 7)

The run is 2 − 2 = 0, so the slope is undefined. The line is vertical and its equation is x = 2.

Slope as an angle and a percent grade

The angle of inclination is the inverse tangent of the slope. A slope of 2 gives arctan(2) ≈ 63.43 degrees.

The percent grade is the slope multiplied by 100, so a slope of 0.05 is a 5% grade. The calculator shows both.

Frequently asked questions

How do you find the slope between two points?

Subtract the y-values to get the rise, subtract the x-values to get the run, and divide the rise by the run. For (1, 2) and (5, 10), the slope is 8 ÷ 4 = 2.

What does it mean if the slope is undefined?

The two points have the same x-value, so the run is 0 and the line is vertical. Division by zero is undefined.

Does it matter which point I call point 1?

No. Swapping the points changes the sign of both the rise and the run, so the slope stays the same.

How do I turn a slope into an angle?

Take the inverse tangent of the slope. A slope of 1 gives 45 degrees.

How do I write the line equation from two points?

Find the slope, then use b = y1 − m × x1 for the y-intercept and write y = mx + b.