Slope Calculator (Two Points)
Calculate the slope (gradient), distance, angle and line equation between two points, in slope-intercept and point-slope form.
Result
Fill in the fields above, then press Calculate.
A slope calculator finds the slope, y-intercept and equation of a line from two points or a point and slope. In UK and Australian maths, slope is called the gradient, so a gradient calculator finds the same number.
Slope formula
The slope m of the line through the points (x₁, y₁) and (x₂, y₂) is the rise divided by the run:
m = (y₂ − y₁) ÷ (x₂ − x₁)
For (3, 4) and (9, 12): m = (12 − 4) ÷ (9 − 3) = 8 ÷ 6 = 4/3 ≈ 1.3333.
If x₁ = x₂ the line is vertical: the run is zero, so the slope is undefined and the equation is x = a constant.
Worked examples
| Points | Slope | Slope-intercept form | Point-slope form |
|---|---|---|---|
| (3, 4) and (9, 12) | m = 4/3 ≈ 1.3333 | y = 4/3x | y − 4 = 4/3(x − 3) |
| (−2, 5) and (4, −7) | m = −2 | y = −2x + 1 | y − 5 = −2(x + 2) |
| (2, 1) and (2, 5) | undefined (vertical line) | x = 2 | — |
For (3, 4) and (9, 12) the distance between the points is 10 and the line makes an angle of 53.13° with the x-axis.
Point-slope form vs slope-intercept form
Point-slope form, y − y₁ = m(x − x₁), is the quickest way to write a line when you know one point on it and the slope. Slope-intercept form, y = mx + b, shows the slope and the y-intercept directly, which makes the line easy to graph.
Examples
Two points
Point-slope
Slope-intercept
Frequently Asked Questions
What does slope represent?
Is slope the same as gradient?
What is a perpendicular slope?
What if the slope is undefined?
Result
Your result appears here and follows you as you scroll.
Quick Tips
- •Double-check your inputs — small errors lead to incorrect results.
- •Use decimal form for fractions when entering values.
- •Remember that vertical lines have undefined slope and cannot be expressed in y = mx + b form.