Slope Calculator

Slope is one idea with four common dialects, and this calculator speaks all of them without mixing them up: the slope m itself (kept as an exact fraction), the angle in degrees, the percent grade, and the 1-in-X ratio used for ramps, pipes and drainage. Enter two points and you also get the full equation of the line and a diagram with the rise and run drawn in; enter rise and run directly and you get the same slope family plus the length along the slope. Vertical lines, whose slope does not exist, are handled explicitly instead of being forced into a number.

Coordinates and rise/run values may be whole numbers, decimals or fractions, and may be negative (a falling line has negative slope). Both axes must use the same unit before a slope means anything physical: metres with metres, not metres against kilometres.

How to use this calculator

  1. Two points: enter (x₁, y₁) and (x₂, y₂). You get the slope as an exact fraction and a decimal, the angle, the percent grade, the ratio forms, the equation of the line, the distance between the points, the midpoint, and a diagram.
  2. Rise and run: enter the vertical and horizontal changes directly (a pipe fall and its length, a ramp’s height and its base). You get the slope family and the length measured along the slope itself.
  3. Read the dialect you need: degrees for geometry and setting out, percent for roads and drainage grades, 1-in-X for ramps and pipes. They are conversions of one number, shown side by side so the right one is quoted.

The method

m = (y₂ − y₁) / (x₂ − x₁) = rise / run. Angle θ = atan(m), in degrees. Percent grade = 100 × m. Ratio form: 1 in (1/m), one unit of rise per that many units of run.

The slope is computed as an exact fraction from the inputs before any decimal appears, so (2, 3) to (6, 11) gives m = 8/4 = 2 exactly. The equation of the line follows from either point: b = y₁ − m·x₁, giving y = mx + b with b also exact. The angle comes from the arctangent of the decimal slope, and it is signed: a line falling left to right has a negative angle, measured below the horizontal.

Vertical and horizontal lines

When x₂ = x₁ the run is zero, the division cannot be done, and the slope is undefined: not infinite, not zero, simply not a number. The line still exists, its angle is exactly 90°, and its equation is x = x₁; the tool reports all of that instead of an error. A horizontal line (y₂ = y₁) is the tame opposite: slope 0, angle 0°, equation y = y₁.

Percent is not degrees

A 100% grade means rise equals run, which is a 45° angle, not a vertical wall. Percent grows without bound as the line steepens (a near-vertical slope might be 5,000%), while degrees stop at 90. Drainage and road specifications live in percent or in 1-in-X ratios (1:100 is a 1% grade, about 0.57°); geometry and setting-out live in degrees. Quoting one in the other’s clothing is the expensive mistake this page is built to prevent.

Worked examples

Example 1: the preloaded points

(2, 3) to (6, 11): rise 8, run 4, slope m = 2, angle 63.43°, grade 200%, equation y = 2x − 1. The points are √80 ≈ 8.94 apart, with midpoint (4, 7), and the line crosses the x-axis at x = 1/2.

Example 2: the preloaded rise and run

Rise 3 over run 4: slope 3/4 = 0.75, angle 36.87°, grade 75%, ratio 1 in 1.333, and the slope length is exactly 5, the 3-4-5 triangle.

Example 3: a horizontal line

(1, 5) to (4, 5): slope 0, angle 0°, grade 0%, equation y = 5. Nothing rises, and every dialect agrees.

Example 4: a vertical line

(3, 1) to (3, 9): the run is 0, so the slope is undefined, the angle is 90°, and the equation is x = 3. The percent grade does not exist either; the tool says so rather than printing a huge number.

Example 5: a falling line

(0, 4) to (4, 0): slope −1, angle −45°, grade −100%, equation y = −x + 4, crossing the x-axis at 4. The negative sign is the direction, in every dialect.

Example 6: a drainage ratio

A 1:100 fall (rise 1, run 100) is slope 0.01, grade 1%, angle about 0.57°. Gentle on paper, and exactly the sort of number that keeps water moving in a pipe; the ratio form is how it is specified on site.

Reading your results

The exact fraction is the slope. The decimal is for reading; the fraction (3/4, not 0.75) is what the equation and the ratio forms are built from, and it carries no rounding. When the inputs are measurements, though, the slope inherits their precision: a rise measured to the nearest centimetre does not justify six decimals of grade.

The equation needs a point. Slope alone describes a direction, shared by infinitely many parallel lines. Two-points mode pins the line down (hence the equation, intercept and midpoint); rise-and-run mode honestly gives no equation, because none is determined.

Angle sign is direction. Positive climbs left to right, negative descends. For physical grades the size is usually quoted (a 6% descent), with the direction stated in words; the signed figures here keep the geometry unambiguous.

Common mistakes

  • Swapping rise and run. m = rise/run; inverting it turns 0.75 into 1.333 and a 36.87° ramp into a 53.13° one. The diagram shows which leg is which; check your numbers against it.
  • Quoting percent as degrees. A “45% slope” and a 45° slope differ by a factor of more than two in steepness (45% is about 24.2°). Road and drainage grades are percent; angles are degrees; never let the number travel without its unit.
  • Pairing the differences inconsistently. (y₂ − y₁)/(x₁ − x₂) flips the sign. Either point can be “first”, but the subtractions must use the same order top and bottom.
  • Calling a vertical slope infinite. Infinity is not a value the slope takes; it is undefined, because the run is zero and division by zero has no result. The angle, 90°, is the well-defined way to describe it.
  • Mixing axis units. A profile drawn with metres vertically and kilometres horizontally has a slope 1,000 times the true one. Convert both axes to one unit first; exaggerated site profiles are drawn that way deliberately and catch people out.
  • Expecting slope to locate the line. m = 2 describes every line at 63.43°, not the one through your points. Without a point (or an intercept) there is no equation, only a direction.

Limitations

  • Straight lines only. The slope of a curve changes from point to point and is the derivative’s job; this page handles the constant slope of a line or a straight run.
  • Roof pitch, stair design and ramp compliance carry building-code constraints (maximum grades, going and riser rules, landing requirements) that belong to their dedicated tools; this page gives the underlying slope arithmetic they build on.
  • Coordinates are exact as typed, and the slope is exact from them; measurements entered with error produce a slope with the same error, enlarged when the run is short. Widely separated points give the most trustworthy slope from real measurements.
  • The 1-in-X ratio is stated for positive slopes; for a falling line the tool reports the signed slope, angle and grade, and the ratio of sizes can be read from the rise : run row.

Frequently asked questions

Are slope, gradient and pitch the same thing?

Slope and gradient are two names for the same number, rise over run. Pitch in roofing is a convention built on it (rise per 12 units of run in US practice) with its own code context, and “grade” is the same slope expressed as a percent. The number is one; the dialects differ, which is why all of them are shown together here.

Why is a vertical slope undefined instead of infinite?

Because slope is a division, run zero means dividing by zero, and that operation has no result, infinite or otherwise. As a line steepens toward vertical its slope grows past every number, which tempts the word infinite, but at exactly vertical there is no slope value; the angle, 90°, is the correct exact description.

Does the point order change the slope?

No, provided the order is consistent: (y₂ − y₁)/(x₂ − x₁) and (y₁ − y₂)/(x₁ − x₂) are the same number, since both differences flip sign together. Mixing the orders, second-minus-first on top and first-minus-second below, is what flips the sign wrongly.

What does “1 in 100” actually mean?

One unit of rise for every 100 units of run: slope 0.01, a 1% grade, about 0.57°. The same convention appears as 1:100. It is the standard language for drainage falls, access ramps and pipe gradients precisely because the ratio scales to any length.

Can a slope be negative?

Yes, and it should be when the line falls. A negative slope with a negative angle and a negative grade all say the same thing: height decreases as x increases. Physical specifications usually quote the size and say “falling” or “descending” in words, but the signed number is what calculations need.

What is the slope of a curve?

It changes along the curve, so a single number does not describe it. At any one point the slope is the derivative there (the gradient of the tangent line), which is what the derivative calculator computes. For a straight segment of a curve, this page gives the average slope between its endpoints, which is often the practical figure.

Related calculators

Method: slope is formed as the exact fraction (y₂ − y₁)/(x₂ − x₁) from the inputs as typed (decimals and fractions converted exactly), then reduced. The angle is atan of the slope in degrees, the grade is 100 times the slope, the 1-in-X figure is its reciprocal, and the equation uses b = y₁ − m·x₁ in exact fractions. A zero run is reported as an undefined slope with the vertical line’s angle and equation, never as a number. Last reviewed: 21 October 2026.

Disclaimer: This calculator gives estimates for general information only. It is not financial, medical or other professional advice.