Math calculator

Slope Calculator

Rise over run, kept as a fraction.

Rise over run

As a fraction, an angle and a grade.

rise 1 ÷ run 3

1/3

The line is rising left to right. As a decimal that is 0.33333333, and as an angle 18.4349°.

Slope

1/3

as a fraction — rise over run

Rise

1

change in y

Run

3

change in x

Angle to horizontal

18.4349°

arctan of the slope

Percent grade

33.3333%

how a road sign quotes it

Perpendicular slope

−3

the negative reciprocal

  • Slope is rise over run: the change in y divided by the change in x, in that order. Taking it the other way round gives the reciprocal, which is a different line.
  • The slope is exact: 1 ÷ 3 = 1/3. Writing it as a fraction keeps it exact where a decimal would not.
  • The order of the two points does not matter, as long as you are consistent. Swapping them negates both the rise and the run, and the two minus signs cancel.

A vertical line is reported as having no slope rather than an infinite one, which is a different statement and the correct one.

What this tool shows

The slope from (1,2) to (4,3) is 1/3, not 0.3333333333. And a vertical line has no slope at all — the run is zero, the division has no answer, and calling it infinite is a different claim that happens to be wrong.

  • The slope between two points
  • The rise and the run separately
  • The angle the line makes with the horizontal
  • The percent grade, as a road sign quotes it
  • The perpendicular slope
  • Why a vertical line has no slope
Exact fractions Angle and grade Vertical handled Perpendicular slope

Exact fractions; vertical reported as undefined.

Updated 7 September 2026 · Works in any browser, no installation

Rise over run: divide the change in y by the change in x. From (1,2) to (4,3) that is 1 ÷ 3, so the slope is 1/3. If the run comes out zero, the line is vertical and has no slope — which is a different statement from having a very large one.

At a glance

Formula shown
m = (y\u2082 \u2212 y\u2081) / (x\u2082 \u2212 x\u2081). The order of the two points does not matter as long as it is the same on top and bottom. A run of zero means a vertical line, whose slope is undefined rather than infinite.
Scenario support
The gradient of a line through two known points; a roof pitch or road grade; checking whether two lines are parallel or perpendicular.
Educational estimate
Planning support from the values you enter — not professional advice.

What slope actually measures

Slope is how much the line climbs for each step across. A slope of 1/3 means: go three to the right, go one up.

That reading is why keeping it as a fraction is useful. 1/3 tells you the step sizes directly; 0.3333333333 does not, and it is not even exactly the number.

It is constant along a straight line, which is what makes a line straight. Pick any two points on it and the ratio comes out the same — that is the definition, not a property to check.

Positive slope rises left to right, negative falls, zero is flat. The larger the size, the steeper, without limit — up to the point where the line goes vertical and the whole idea stops applying.

Vertical is not infinite

For a vertical line the run is zero, and the slope would be rise divided by zero. That has no answer.

“Infinite” is the wrong word and it is worth being precise about why. Approaching vertical from one side the slope grows without bound; approaching from the other it falls without bound. The two sides disagree, so no single value can be assigned — which is exactly what undefined means.

It also matters in practice. Code that returns Infinity for a vertical slope will happily carry it into y = mx + c and produce NaN three steps later. Reporting it as undefined stops the calculation where it should stop.

The equation still exists: x = a constant. Standard form Ax + By = C handles it because B can be zero. Only the y = mx + c form cannot express it, which is one of the better arguments for knowing more than one form.

Do not confuse it with zero. A HORIZONTAL line has slope exactly 0; a VERTICAL line has none. They are opposites and the words are easy to swap under pressure.

Angle, grade and slope

Three ways to say the same steepness, and they are not interchangeable numbers.

Slope is the ratio: rise over run. Dimensionless.

Grade is that ratio as a percentage. A slope of 0.08 is an 8% grade — eight units up for every hundred along. This is what a road sign means.

Angle is the arctangent of the slope. An 8% grade is 4.57°, not 8°, and the gap widens as things get steeper: a 100% grade is 45°, not 90°.

That last point catches people. A 100% grade sounds vertical and is a comfortable staircase pitch. Grade and angle only agree near zero.

Perpendicular and parallel

Parallel lines have the same slope. That is the whole test, and it is why slope is the useful quantity rather than the angle.

Perpendicular slopes multiply to −1. So the perpendicular to 2/3 is −3/2 — flip the fraction, change the sign. Both steps, every time.

The rule has two exceptions and they are the ones that matter. A horizontal line (slope 0) is perpendicular to a vertical one (no slope), and 0 × undefined is not −1. The product rule simply does not apply there, which is a gap in the rule rather than a special case of it.

Where it gets used

Construction. Roof pitch, ramp gradient, drainage falls. Accessibility standards are written in slope: a wheelchair ramp is typically capped at 1:12, which is 8.33%.

Roads and rail. Grade signs, and the much tighter limits on rail — a few per cent is steep for a train, because steel on steel has little grip.

Graphs and data. The slope of a line of best fit is the rate of change: how much y moves per unit of x. It is the answer to “per what”.

Calculus. A derivative is the slope of a curve at a point, defined as the limit of exactly this rise-over-run calculation as the two points come together.

The mistakes worth naming

Run over rise. Inverting the fraction gives a different line. Rise is on top, always — the change in y, the thing that depends.

Mixing the order. y₂ − y₁ on top and x₁ − x₂ underneath gives the negative of the slope. Same order both times.

Confusing zero and undefined. Horizontal is 0, vertical is none.

Reading grade as angle. A 20% grade is 11.3°, not 20°.

Sources and methodology

Slope and grade are defined consistently across mathematics and engineering; these are the references.

Method. The rise, the run and the slope are carried as exact rationals, so the slope of a line through rational points is reported as a fraction rather than a repeating decimal. Whether the line is vertical is decided on the run being exactly zero, before any division happens — which is why the page can report "no slope" rather than Infinity. The angle and the percent grade are derived from that exact slope and are decimal, and the page says so. That engine is verified on every change against 67 hand-written assertions, including that reversing the two points gives the same slope, and that the reported perpendicular slope multiplies with it to exactly −1, across four thousand generated pairs. The count and the per-case breakdown are published on the formula verification page.

Related calculators

Where this goes next:

Line EquationThe equation of a line in all three standard forms from two points or from a point and a slope, with the intercepts and the vertical case that has no y = mx + c form at all.
Parallel and Perpendicular LinesBoth lines through your point at once — and the two cases where the slopes-multiply-to-−1 rule does not apply, because 0 × undefined is not −1.
DistanceThe distance between two points in the plane or in space, kept exact as a surd wherever the square root does not come out — √50 stays √50, and is also shown as 5√2.
MidpointThe midpoint of a segment, plus the reverse problem nobody else solves: given one endpoint and the midpoint, where is the other endpoint?
Slope PercentageConvert a slope between percentage grade, degrees, a 1:n ratio and rise per run, or find the fall to set out across a known distance.
Trigonometric FunctionsAll six functions at once with exact surd values at the sixteen special angles — and tan 90° reported as undefined rather than as the 1.6 × 10¹⁶ a double returns.

More in Math, or browse all calculators.

Read the guide

With the slope in hand, the Line Equation Calculator writes the line in all three standard forms — including the x = k form that a vertical line has and y = mx + c cannot express.

Educational use disclaimer

This is an educational tool. The slope is exact for the coordinates entered; the angle and the percent grade involve a trigonometric function and are decimal.

How we calculate · Found an error? email us

Authorship & verification

Written and maintained by , a business operator who builds spreadsheet-based calculators.

What's changed (3 updates)

Published 7 September 2026

  1. Published the slope page keeping the answer as an exact fraction, since a slope of 1/3 is a fact about the line and 0.3333333 is a rounding of it.
  2. A vertical line is reported as having no slope rather than as an error or an infinity, and the page separates that from a horizontal line's slope of exactly zero — the two get confused constantly.
  3. Adds the angle of inclination and the gradient as a percentage, because a road sign and a roof pitch use those rather than the fraction.

Add this calculator to your site

Responsive embed — and private: nothing your visitors type leaves their browser.