Explore all tools
FREE ONLINE TOOLNo visitor account required

Slope Calculator

Slope, equation, y-intercept, distance, midpoint and angle of the line through two points — plotted on a coordinate diagram.

—

Slope m

Equation—
y-intercept—
Distance between points—
Midpoint—
Angle to x-axis—

Note: A vertical line (same x twice) has an undefined slope; the calculator reports that honestly and gives the equation as x = constant.

Report a problem with this tool

Slope: Rise Over Run

The slope of the line through two points is how much y grows for each unit x grows: m = (y2 − y1) / (x2 − x1). From the slope and one point, the whole line follows: y = mx + b, with the intercept b = y1 − m·x1. The calculator also returns the distance between the points, their midpoint, and the angle the line makes with the x-axis — the four facts that between them describe the line completely. The coordinate diagram plots your two points and the line through them so a sign error is visible at a glance.

runrise(x₁, y₁)(x₂, y₂)

Worked Example

From (1, 2) to (4, 8): the rise is 8 − 2 = 6 and the run is 4 − 1 = 3, so the slope is 2. The intercept is 2 − 2 × 1 = 0, giving the tidy equation y = 2x. The points are √(32 + 62) = √45 ≈ 6.71 apart, their midpoint is (2.5, 5), and the line climbs at arctan(2) ≈ 63.43°. A slope of 2 as a road grade would be 200% — real roads stay under about 0.12 — which is why slope in everyday life is usually a small decimal or a percentage.

Zero, Undefined and Negative Slopes

A horizontal line has slope 0 (the rise is zero). A vertical line has undefined slope — the run is zero and division by zero has no answer; the calculator says so instead of inventing a number, and gives the equation as x = a constant. Negative slopes fall as x increases. Swapping the two points changes nothing: rise and run both flip sign together, so the slope, distance and midpoint are identical whichever point you call first.

Frequently Asked Questions

How is slope calculated?

Slope = rise over run: (y2 - y1) / (x2 - x1). From (1, 2) to (4, 8) that is 6 / 3 = 2.

What does an undefined slope mean?

The line is vertical — both points share the same x, so the run is zero and the division has no answer. The equation is written as x = that shared value.

Does the order of the points matter?

No. Swapping the points flips the sign of both rise and run, so the slope, distance and midpoint all come out identical.

How do I turn slope into a percentage grade?

Multiply by 100. A slope of 0.08 is an 8% grade — it rises 8 units for every 100 units across.