Math & ScienceFull line analysis

Slope Calculator

Two points define a line, and a line has more useful properties than just its gradient. This returns the equation in three forms, the angle in degrees and as a percentage grade, and the distance and midpoint.

Two Points

Any real coordinates, including negatives and decimals.

SLOPE (m)
Rise (Δy)
Run (Δx)
Slope as a fraction
Angle of incline
Grade (percentage)
Direction

The line itself

Slope-intercept form
Point-slope form
Standard form
y-intercept
x-intercept
Perpendicular slope

Between the two points

Distance
Midpoint

Rise over run, and the two cases that break it

m = (y₂ − y₁) / (x₂ − x₁). A positive slope climbs left to right, a negative one falls, and zero is perfectly level.

The two edge cases matter. A vertical line has Δx = 0, so the slope is undefined — not infinite, not zero, undefined, because the division cannot be performed. A horizontal line has Δy = 0 and a slope of exactly zero. Calling a vertical line "infinite slope" is the mistake that produces a division-by-zero crash the first time someone codes it.

Degrees or percent: they are not the same thing

Road signs use percentage grade, which is just the slope × 100 — a 10% grade rises 10 metres over 100 horizontal metres. The angle is arctan(m), so a 10% grade is 5.7°, not 10°. They only agree near zero and diverge badly as the slope rises: a 100% grade is 45°, and there is no percentage that corresponds to vertical.

Three forms of the same line

Slope-intercept (y = mx + b) is the most readable and the fastest to graph. Point-slope (y − y₁ = m(x − x₁)) is what you write down first, before any rearranging. Standard form (Ax + By = C) is the only one that can express a vertical line, which is why linear algebra prefers it.

Perpendicular and parallel

Parallel lines share a slope. Perpendicular lines have slopes whose product is −1, so the perpendicular slope is the negative reciprocal: a line of slope 2 is crossed at a right angle by one of slope −½. The exception is the horizontal/vertical pair, where one slope is zero and the other undefined — the product rule cannot be applied and the answer is handled separately.

Frequently Asked Questions

What is the slope of a vertical line?
Undefined. The run is zero, so the division cannot be carried out. A vertical line still has a perfectly good equation in standard form (x = a), which is one reason that form is worth knowing.
How do I convert a slope into an angle?
Take the arctangent: angle = arctan(m), in degrees. A slope of 1 is 45°, a slope of 0.5 is about 26.6°. Both figures are shown above so there is no need to convert by hand.
What is the difference between slope and grade?
Grade is the slope written as a percentage — slope × 100. A 6% grade means a rise of 6 units per 100 horizontal units, which is an angle of 3.4°, not 6°.
How do I find the distance between two points?
Apply Pythagoras to the rise and run: distance = √(Δx² + Δy²). The result appears in the final block above, together with the midpoint.
Where these numbers come from

Sources

Official publications only. Links open the original document in a new tab.