Slope Calculator
Two points in, the whole line out — slope, equation, both intercepts and the angle of inclination.
Updated
Slope, distance and midpoint
2slope
Rise 6 over run 3.
- Equation
- y = 2x
- y-intercept
- 0
- x-intercept
- 0
- Angle of inclination
- 63.4349°
- Distance between the points
- 3√5 ≈ 6.7082
- Midpoint
- (2.5000, 5)
The distance, step by step. Δx = 3 and Δy = 6, so d = √(3² + 6²) = √45 = 3√5 ≈ 6.7082. The midpoint averages each coordinate separately: (1 + 4) ÷ 2 and (2 + 8) ÷ 2.
Advertisement
In short
How do you find the slope between two points?
Subtract the y values, subtract the x values in the same order, and divide. From (1, 2) to (4, 8) the rise is 6 and the run is 3, so the slope is 2. Reversing both points gives the same answer, because both signs flip.
When the run is zero the line is vertical and the slope is undefined — not infinite, and not zero.
How to use the slope calculator
Slope measures how steeply a line climbs: the change in y divided by the change in x, usually said as rise over run. From (1, 2) to (4, 8) the line climbs 6 while moving across 3, so the slope is 2 — every step right lifts it two steps up. A negative slope falls instead, and a slope of zero is flat.
The order of the two points does not matter as long as it is consistent. Taking the second point first flips the sign of both the rise and the run, and a negative divided by a negative is positive again. What does matter is not mixing them: subtracting y in one order and x in the other gives the slope with the wrong sign, and nothing about the answer will look suspicious.
2
Slope from (1,2) to (4,8)
rise 6 over run 3
0
Slope of a horizontal line
a real number
—
Slope of a vertical line
undefined, not infinite
Advertisement
That last distinction is worth being firm about. A vertical line has a run of exactly zero, and division by zero is undefined rather than infinite. Calling it "infinite slope" is informal limiting language: as a line tips towards vertical its slope grows without bound, but at vertical there is no value at all. The line still exists and is written x = 3 instead.
The angle of inclination is the one figure with a convention attached. It is measured counterclockwise from the positive x axis and runs from 0 up to but not including 180 degrees, so a line falling at 45 degrees has an inclination of 135 rather than −45. Taking arctan of the slope directly gives the wrong answer for every negative slope.
- Slope-intercept
- y = mx + b
- Point-slope
- y − y₁ = m(x − x₁)
- Standard
- Ax + By = C
- Vertical line
- x = a — only standard form can write it
- Horizontal line
- y = b, with m = 0
Slope-intercept is the most readable and cannot express a vertical line at all, since it needs a value for m. That limitation is a fact about the notation rather than about the line.
Curves, when a straight line will not do
A parabola has a different slope at every point. The quadratic page finds where one crosses the x axis and where its turning point sits.
Open the quadratic calculator →Point pairs with the slope, the angle of inclination, the equation of the line and the distance between the points, including the two cases that break the usual form.
| From → to | Slope | Angle / equation | Distance |
|---|---|---|---|
| (1,2) → (4,8) | 2 | 63.43° / y = 2x | 3√5 |
| (0,0) → (1,1) | 1 | 45° / y = x | √2 |
| (0,0) → (1,−1) | −1 | 135° / y = −x | √2 |
| (0,3) → (2,7) | 2 | 63.43° / y = 2x + 3 | 2√5 |
| (1,5) → (9,5) | 0 | 0° / y = 5 | 8 |
| (3,1) → (3,9) | undefined | 90° / x = 3 | 8 |
| (0,0) → (12,1) | 0.0833 | 4.76° / y = 0.0833x | √145 |
| (2,4) → (6,2) | −0.5 | 153.43° / y = −0.5x + 5 | 2√5 |
| (−2,−3) → (2,5) | 2 | 63.43° / y = 2x + 1 | 4√5 |
| (0,4) → (4,0) | −1 | 135° / y = −x + 4 | 4√2 |
Slope outside the coordinate plane
Every real gradient is a slope: a roof pitch, a wheelchair ramp, a railway grade, a road sign warning of a descent. Road signs use percentages, which is slope multiplied by a hundred — an eight percent grade rises eight metres over a hundred travelled. Roofs are quoted as a rise over a twelve-unit run, so a 6:12 pitch is a slope of 0.5.
- As a slope
- 0.0833
- As a ratio
- 1 : 12
- As a percentage
- 8.33%
- As an angle
- 4.76°
- One line
- four ways of quoting it
The angle is the one that is not a simple rescaling of the others: it comes from arctan rather than from multiplication, which is why a doubling of the slope does not double the angle. At small slopes they track closely and they separate quickly above about twenty percent.
Ramp and access requirements are usually written as ratios for this reason — a ratio is checkable with a tape measure and an angle is not. Where a specific figure is required by regulation, take it from the regulation rather than from a conversion, because permitted maxima vary by application and by whether the work is new or existing.
Parallel, perpendicular, and the negative reciprocal
Two lines are parallel when their slopes are equal — same steepness, different position. They are perpendicular when the product of their slopes is exactly −1, which means each slope is the negative reciprocal of the other. A line of slope 2 is crossed at a right angle by a line of slope −0.5.
Do
- Subtract the coordinates in the same order for both axes
- Write a vertical line as x = a rather than forcing y = mx + b
- Add 180 degrees when converting a negative slope to an inclination
- Take regulatory gradient limits from the regulation itself
Don't
- Call a vertical slope infinite
- Mix the order of subtraction between x and y
- Assume arctan alone gives the angle of inclination
- Confuse a slope of zero with an undefined slope
The perpendicular rule has one exception, and it is the same one as everywhere else on this page: a vertical and a horizontal line are perpendicular, but their slopes are undefined and zero, and no product of those two equals −1. The rule works for every pair except the one that includes a vertical line.
Advertisement
Full guide
Percent Grade to Degrees: Why a 100% Grade Is 45 Degrees, Not Vertical
A 100% grade is 45 degrees. Percent grade has no ceiling; degrees stop below 90, and that mismatch is where every conversion error starts.
Read the full guide →The formula, worked line by line
One division for the slope, and five more formulas that fall out of the same two points without any further measurement.
“Rise over run. The only thing that can go wrong is subtracting in one order on top and the other underneath, and the answer will not look wrong when you do.”
That silence is what makes it worth a deliberate habit: write both subtractions the same way round every time, even when the numbers are easy enough to do in your head.
slope m = (y₂ − y₁) ÷ (x₂ − x₁)
y-intercept b = y₁ − m × x₁
equation: y = mx + b
distance = √((x₂ − x₁)² + (y₂ − y₁)²)
midpoint = ((x₁ + x₂) ÷ 2, (y₁ + y₂) ÷ 2)- Rise
- 5 − (−3) = 8
- Run
- 2 − (−2) = 4
- Slope
- 8 ÷ 4 = 2
- y-intercept
- −3 − 2 × (−2) = 1
- Distance
- √(16 + 64) = 8.944
- Equation
- y = 2x + 1
The distance formula is the Pythagorean theorem in disguise: the run and the rise are the two short sides of a right triangle and the distance is its hypotenuse. Recognising that means never having to memorise it separately.
Why the sign of the slope tells you the direction
A positive slope rises left to right; a negative slope falls. The magnitude says how fast: a slope of 5 is five times steeper than a slope of 1, and a slope of 0.2 is five times shallower. Values between −1 and 1 describe lines closer to horizontal than to vertical, which is a useful sense check when a figure looks surprising.
Gradient and slope
- Slope
- the usual term in US materials
- Gradient
- the usual term in UK materials
- Grade
- civil engineering, quoted as a percentage
- Pitch
- roofing, quoted as rise over a run of 12
- All of them
- rise divided by run
The preference is regional rather than exclusive — both words appear in both places, and neither is more correct. Only the notation changes: a percentage, a ratio or a decimal, all measuring the same thing.
The one that reads differently is pitch, because its run is fixed at twelve by convention rather than being whatever the horizontal distance happens to be. A 6:12 pitch is a slope of one half, and a 12:12 pitch is a slope of one, which is 45 degrees.
Advertisement
Questions people ask
How do you find the slope between two points?
Subtract the y coordinates, subtract the x coordinates in the same order, and divide the first by the second. From (1, 2) to (4, 8) the rise is 6 and the run is 3, giving a slope of 2. Taking the points in the opposite order flips both signs and leaves the answer unchanged.
Covered in depth in Percent Grade to Degrees: Why a 100% Grade Is 45 Degrees, Not Vertical →
What is the slope of a vertical line?
Undefined. The run is exactly zero, and dividing by zero has no value — it is not infinity. A vertical line is perfectly real and is written x = a, but slope-intercept form cannot describe it because that form requires a numeric slope. A horizontal line is different: its slope is exactly zero.
What is the difference between slope and gradient?
Nothing mathematically. Slope is the more common term in United States materials and gradient the more common one in the United Kingdom, but both appear in both places and both mean rise divided by run. Civil engineering calls it grade and quotes it as a percentage; roofing calls it pitch and quotes it over a run of twelve.
How do you find the angle of a line from its slope?
Take the arctangent of the slope, then add 180 degrees if the result is negative. The angle of inclination is measured counterclockwise from the positive x axis and runs from 0 to just under 180, so a slope of −1 gives 135 degrees rather than the −45 that arctan returns on its own.
Does this page give the distance between the two points as well?
Yes, as a byproduct — the same two coordinates determine it, so it is shown alongside the midpoint without being entered twice. For the substitution written out step by step, the exact radical form and the three-dimensional case, the distance formula calculator is the page built around that question.
When are two lines perpendicular?
When the product of their slopes is exactly −1, so each is the negative reciprocal of the other — a line of slope 2 meets a line of slope −0.5 at a right angle. The one exception is a vertical and a horizontal line, which are perpendicular even though their slopes are undefined and zero.
Sources
Where the constants and formulas on this page come from. Each line names the figure it backs.
The slope of a line is the change in y divided by the change in x, and is undefined for a vertical line.
Slope — Wolfram MathWorld
The angle of inclination of a line is measured counterclockwise from the positive x axis over the range 0 to 180 degrees.
Inclination — Wolfram MathWorld
The distance between two points follows from the Pythagorean theorem applied to the horizontal and vertical separations.
Distance Formula — Wolfram MathWorld
Related guides
Math
Why the Quadratic Formula Loses Accuracy on One of Its Two Roots
Completing the square takes four lines and produces the formula. It also shows which of the two roots is safe to trust, and the calculator on this site was corrected to use the other route.
August 19, 2026 · 10 min read
Math
Geometry Backwards: Finding the Radius from the Area
Every geometry formula is printed in the direction you need least. Running it backwards is not the same operation reversed; it is a root, and roots can refuse.
August 17, 2026 · 10 min read
Math
When Cross Multiplication Gives You the Wrong Answer
Cross multiplication answers every question you put to it, including the ones it should refuse. The test is one line: if the input were zero, would the output be zero?
August 17, 2026 · 10 min read