Slope & Distance Calculator
Slope is rise over run — how much it climbs for each step across. The percentage on a road sign is the same number times a hundred.
Distance
5.0000
- Slope
- 1.3333
- Distance
- 5.0000
- Rise
- 4.0000
- Run
- 3.0000
- Midpoint
- (2.500, 4.000)
- Angle
- 53.13°
- As a percentage grade
- 133.33%
- Slope is rise over run — how much it climbs for each step across. A slope of 1 is 45 degrees, and the percentage grade on a road sign is the same number times a hundred.
- A vertical line has no slope rather than an infinite one. Dividing by a zero run is undefined, and calling it infinity papers over the difference.
- The distance formula is Pythagoras applied to the rise and the run, which is why it has a square root in it.
About slope and distance
Two points fix a line, and three numbers describe it. The slope says how steep it is, the distance says how far apart the points are, and the midpoint sits halfway between them. From (1, 2) to (4, 6) the slope is 4/3, the distance is 5 and the midpoint is (2.5, 4).
A slope of 1 is 45 degrees. Anything above 1 is steeper than 45 degrees, which is steeper than almost any road — a 10% gradient sign means a slope of 0.1, or about 5.7 degrees. The percentage grade and the angle are not the same thing and diverge quickly above about 20%.
A vertical line has no slope rather than an infinite one. The run is zero and dividing by it is undefined, which is a different statement from "very large". Calling it infinity papers over a real distinction and produces nonsense in anything built on top of it.
The distance formula is Pythagoras wearing a different hat. The rise and run are the two short sides of a right-angled triangle and the distance is the hypotenuse, which is why there is a square root in it.
What it works out
- Slope, and the percentage grade
- Distance between the points
- Midpoint and the angle from horizontal
The formula
Slope = (y₂ − y₁) ÷ (x₂ − x₁) Distance = √((x₂ − x₁)² + (y₂ − y₁)²)
From (1, 2) to (4, 6): the run is 3 across and the rise is 4 up. The slope is 4 ÷ 3, or 1.333.
The distance is √(3² + 4²), which is 5 — the same 3-4-5 triangle, with the rise and run as its short sides. That is not a coincidence in the formula; the distance between two points literally is the hypotenuse of the triangle they make with the axes.
The midpoint averages each coordinate separately: (1+4)/2 and (2+6)/2, giving (2.5, 4).
The angle is the arctangent of the slope — 53.13 degrees here. Note how far that is from the percentage grade of 133%, which is the same slope expressed differently. Road signs use the percentage because it is easier to compute from a map, and the two only look similar below about 20%.
A vertical line breaks the slope calculation because the run is zero. The distance and midpoint still work fine.
- Rise
- The change in y — how far up.
- Run
- The change in x — how far across.
- Slope
- Rise over run. Also called the gradient.
- Grade
- The slope as a percentage. What a road sign shows.
A worked example
From the point (1, 2) to the point (4, 6).
That works out to 5.0000 .
- Slope
- 1.3333
- Distance
- 5.0000
- Rise
- 4.0000
- Run
- 3.0000
- Midpoint
- (2.500, 4.000)
- Angle
- 53.13°
- As a percentage grade
- 133.33%
Questions
How do I calculate slope?
Rise over run — the change in y divided by the change in x. From (1,2) to (4,6) that is 4 ÷ 3, or 1.333.
What is the slope of a vertical line?
Undefined, not infinite. The run is zero and dividing by zero has no answer. That is a real distinction rather than a technicality.
What is the slope of a horizontal line?
Zero. There is no rise, so the numerator is zero and the whole thing is zero. Flat lines have a slope; vertical ones do not.
How does slope relate to a percentage gradient?
Multiply by a hundred. A slope of 0.1 is a 10% gradient. It is not the angle — a 10% grade is about 5.7 degrees, and the two diverge quickly above 20%.
How do I find the distance between two points?
Pythagoras on the rise and the run: √(rise² + run²). A rise of 4 and a run of 3 gives a distance of 5.
What is the midpoint formula?
Average each coordinate separately. Between (1,2) and (4,6) the midpoint is ((1+4)/2, (2+6)/2), which is (2.5, 4).
Is slope the same as gradient?
Yes — the words are interchangeable for a straight line. Gradient is more common in Britain and in engineering, slope in American teaching.