Slope Calculator

Enter two points (x₁, y₁) and (x₂, y₂) to get the slope, line equation, angle of incline, percent grade, distance, and midpoint — instantly, right in your browser.

Enter both points above to calculate the slope

How to calculate the slope between two points

The slope of a line through two points (x₁, y₁) and (x₂, y₂) measures how steeply it rises or falls: m = (y₂ − y₁) / (x₂ − x₁), the change in y (often called "rise") divided by the change in x ("run"). Enter your two points above and this calculator plugs them into the formula, shows the substitution step by step, and gives you the slope, the full line equation y = mx + b, the angle of incline, the percent grade, the distance between the points, and their midpoint — all at once.

Worked example

Points (1, 2) and (4, 8). m = (8 − 2) / (4 − 1) = 6 / 3 = 2. The line rises 2 units for every 1 unit it moves right. Using point (1, 2): b = y₁ − m·x₁ = 2 − 2·1 = 0, so the equation of the line is y = 2x. The distance between the points is √((4−1)² + (8−2)²) = √(9 + 36) = √45 ≈ 6.708, and their midpoint is ((1+4)/2, (2+8)/2) = (2.5, 5).

Reading the slope value

The sign and size of the slope tell you everything about the line's direction and steepness before you even look at a graph:

SlopeMeaningLine direction
m > 0Positive slopeRises from left to right
m = 0Zero slopePerfectly horizontal (y₁ = y₂)
m < 0Negative slopeFalls from left to right
UndefinedVertical lineStraight up and down (x₁ = x₂)

Slope as percent grade

Percent grade is simply the slope written as a percentage instead of a ratio: percent grade = slope × 100. It's the everyday unit used on road signs, construction blueprints, wheelchair ramps, and hiking-trail markers.

Example — a 5% grade. A slope of 0.05 is a 5% grade: the road rises 5 units of height for every 100 units traveled horizontally. That corresponds to an angle of incline of about 2.86° — a gentle, everyday incline, not a steep one.

Example — a 100% grade isn't vertical. A slope of 1 (a 45° angle) is a 100% grade — rise equals run. Many people assume 100% means straight up, but a truly vertical rise is an undefined slope (infinite grade), not 100%.

The line equation: y = mx + b

Once you know the slope m, you can find the y-intercept b — where the line crosses the y-axis — by substituting either point into y = mx + b and solving: b = y − mx. For the example above, b = 2 − 2(1) = 0, giving y = 2x. If the line is vertical (x₁ = x₂), it can't be written as y = mx + b at all; instead its equation is simply x = (the shared x-value), since every point on the line shares that same x-coordinate regardless of y.

Common mistakes and quick tips

Sources & further reading

Frequently asked questions

How do I find the slope between two points?

To find the slope between two points (x₁, y₁) and (x₂, y₂), use the slope formula m = (y₂ − y₁) / (x₂ − x₁) — the change in y (rise) divided by the change in x (run). For example, with (1, 2) and (4, 8): m = (8 − 2) / (4 − 1) = 6 / 3 = 2, so the line rises 2 units for every 1 unit it moves right. Once you have the slope, you can find the full line equation y = mx + b by solving for b using either point: b = y − mx. This calculator does all of that automatically and also shows the angle of incline, percent grade, distance between the points, and their midpoint.

What does a negative, zero, or undefined slope mean?

A positive slope means the line rises from left to right; a negative slope means it falls from left to right — the larger the number (positive or negative), the steeper the incline. A slope of exactly zero means the line is perfectly horizontal, which happens whenever y₁ equals y₂. A slope is undefined — not zero — when the line is vertical, which happens whenever x₁ equals x₂, because the run (x₂ − x₁) becomes zero and division by zero has no defined result. This calculator detects the vertical case automatically and reports the slope as undefined instead of showing an error.

What is percent grade, and how is it different from slope?

Percent grade is the slope expressed as a percentage instead of a ratio: percent grade = slope × 100, so a slope of 0.05 is a 5% grade. It's the standard way road signs, construction plans, and ramps describe steepness — a 5% grade means the surface rises 5 units of height for every 100 units of horizontal distance. A slope of 1 (a 45° angle) equals a 100% grade, which often surprises people who assume 100% means vertical — a truly vertical rise is an undefined slope, not a 100% grade. This calculator shows the percent grade alongside the slope so you can use whichever unit your project calls for.

What happens when the line between my two points is vertical?

When both points share the same x-coordinate (x₁ = x₂), the line connecting them is perfectly vertical, and its slope is mathematically undefined because the slope formula would require dividing by zero. Rather than showing an error, this calculator recognizes the vertical case, reports the slope as undefined, gives the line's equation as x = (the shared x-value), and shows the angle of incline as 90°. The distance between the points and their midpoint are still calculated normally in this case, since neither one depends on the slope.

Is the coordinate data I enter sent to a server?

No. This slope calculator runs entirely in your browser — the coordinates you enter for both points never leave your device, and nothing is uploaded, logged, or stored on a server. There's no sign-up, account, or tracking involved, so you can use it freely for homework, geometry practice, construction grade checks, or engineering quick checks with full privacy.