Slope Calculator
Slope, equation and angle from two points.
Inputs
- Working
- m = (y₂ − y₁) ÷ (x₂ − x₁) = (11 − 3) ÷ (6 − 2) = 8 ÷ 4 = 2; b = y₁ − m·x₁ = 3 − 2 × 2 = −1
- Equation
- y = 2x − 1
- Point-slope form
- y − 3 = 2(x − 2)
- y-intercept
- (0, −1)
- Angle with the x-axis
- 63.43°
- Distance between the points
- 8.9443
Use this calculator on your own site
Free embed
- Two lines of HTML, unlimited views
- Shows a small CalculateEveryday bar, with a credit link under the calculator
What each Slope input means
- x₁
- x₁ and y₁ are the first point. Each point's two coordinates must stay together; which point comes first does not change the slope.
- x₂
- x₂ and y₂ are the second point. If x₂ equals x₁ the line is vertical and the slope is undefined; if y₂ equals y₁ the line is horizontal and the slope is 0.
Slope formula
m = (y₂ − y₁) ÷ (x₂ − x₁); then b = y₁ − m·x₁ gives y = mx + b
Slope measures steepness: the vertical change (rise) divided by the horizontal change (run) between two points on a line, m = (y₂ − y₁) ÷ (x₂ − x₁). On a straight line it comes out the same for every pair of points, which is what makes it the line's own number. A positive slope rises to the right, a negative one falls, zero is horizontal, and a vertical line has no slope at all because its run is zero. Once m is known, putting either point into y = mx + b gives the y-intercept b, and the point-slope form y − y₁ = m(x − x₁) can be written down straight away. The angle the line makes with the x-axis is the inverse tangent of the slope, and the slope times 100 is the percent grade used for roads and ramps.
Formula last checked against OpenStax College Algebra 2e, §2.2 'Linear Equations in One Variable' (slope formula, slope-intercept and point-slope forms, horizontal, vertical, parallel and perpendicular lines); 2010 ADA Standards for Accessible Design, §405.2 (ramp slope) on 2 October 2026. Built and maintained by Suman Kumar · How we check
Slope worked example
From (2, 3) to (6, 11) the line rises 8 while running 4, so m = 8 ÷ 4 = 2. Substituting (2, 3): b = 3 − 2 × 2 = −1, giving y = 2x − 1. The line climbs at about 63.43° to the x-axis.
More Slope examples
From (−1, 4) to (3, −2): the rise is −2 − 4 = −6 and the run is 3 − (−1) = 4, so m = −6 ÷ 4 = −1.5, or −3/2 as a fraction. Then b = 4 − (−1.5)(−1) = 2.5, and the line is y = −1.5x + 2.5, falling at 56.31° below the horizontal.
A roof that rises 6 inches for every 12 inches across: m = 6 ÷ 12 = 0.5, which builders call a 6-in-12 pitch. The angle is 26.57°, and as a road grade the same slope would be 50%.
Both points at x = 4: the run is 0, so the headline reads Undefined (vertical line), and the equation is simply x = 4.
Where the Slope calculator can give the wrong answer
- When both points share an x-coordinate the run is zero and the slope is undefined — the line is vertical and is written x = a constant, not y = mx + b.
- When both points share a y-coordinate the slope is 0 and the equation collapses to y = a constant.
- The slope as a fraction is only shown when all four coordinates are whole numbers; with decimals a reduced fraction would be a rounding of a rounding.
- Swapping the two points changes the sign of both rise and run, so the slope is the same either way.
Spotted a mistake? Tell us
Slope reference table
| Slope (rise ÷ run) | Angle with the horizontal | Percent grade | Roof pitch (rise in 12) |
|---|---|---|---|
| 0 | 0° | 0% | Flat |
| 1/12 ≈ 0.0833 | 4.76° | 8.33% | 1 in 12 — the steepest ramp the ADA allows |
| 0.25 | 14.04° | 25% | 3 in 12 |
| 0.5 | 26.57° | 50% | 6 in 12 |
| 0.75 | 36.87° | 75% | 9 in 12 |
| 1 | 45° | 100% | 12 in 12 |
| 2 | 63.43° | 200% | 24 in 12 |
| Undefined | 90° | — | Vertical |
Slope FAQ
- No. Reversing them makes rise and run both change sign, and the signs cancel. Just keep each point's x and y together.
- It is how steeply the line tilts from horizontal: a slope of 1 is 45°, a slope of 2 is about 63.43°, and a negative slope gives a negative angle, tilting downward to the right.
- Divide the change in y by the change in x: (y₂ − y₁) ÷ (x₂ − x₁). From (2, 3) to (6, 11) that is 8 ÷ 4 = 2.
- Find m from the two points, then b = y₁ − m × x₁. For (2, 3) with m = 2, b = 3 − 4 = −1, so y = 2x − 1.
- y − y₁ = m(x − x₁), written straight from one point and the slope. For (2, 3) and m = 2 it is y − 3 = 2(x − 2), which rearranges to y = 2x − 1.
- A horizontal line has slope 0, because its rise is 0. A vertical line's slope is undefined, because its run is 0 and division by zero has no answer.
- Parallel lines have equal slopes. Perpendicular lines have slopes that multiply to −1 — negative reciprocals — so a line perpendicular to one of slope 2 has slope −1/2.