Skip to content

Slope Calculator

Written by Dr. Andrew Chen Dr. Andrew Chen, PhD in Computer Science
Reviewed by Prof. Omar Farooq Prof. Omar Farooq, PhD in Mechanical Engineering

Last updated 2026-08-16 · 4 cited sources

Slope is how steeply a straight line rises or falls: the change in y divided by the change in x between any two points on it, written m = (y₂ − y₁) ÷ (x₂ − x₁). Wolfram MathWorld states the same quantity as m = Δy/Δx = tan θ, which makes the slope and the angle of incline two spellings of one number.

Type four coordinates — x₁, y₁, x₂ and y₂ — and the calculator returns the slope, the subtraction it performed, the finished line equation y = mx + b, the incline angle in degrees, and the distance between the points. Entering 1, 2, 4 and 8 returns m = 2, the line y = 2x + 0, an angle of 63.4349° and a distance of 6.7082.

Two inputs produce something other than a number. Points that share an x value make a vertical line, whose slope is undefined rather than zero or infinite, and two identical points define no line at all. Everything is rounded to four decimal places, so a slope of one-twelfth prints as 0.0833.

Slope Calculator

Enter your values below.

Slope (m)

Enter your details and press “Calculate” to see your results.

Slope = rise over run: m = (y₂ − y₁) ÷ (x₂ − x₁) — how much the line climbs per unit of horizontal travel. From it the calculator builds the full line equation y = mx + b (solving the intercept from either point), the incline angle (arctan of m), and the straight-line distance between your points. The one exception is handled honestly: equal x-values make a vertical line, whose slope is undefined — not zero, not infinity-as-a-number.

What Is Slope?

MathWorld defines slope as the quantity that gives the inclination of a curve or line with respect to another curve or line, and for a straight line in the xy-plane it fixes the value at m = Δy/Δx = tan θ. Two points are enough to pin it down, and one number then describes the whole line: every other pair of points on that line returns the same m.

Slope Is Rise Over Run

Rise is the vertical change between two points, run is the horizontal change, and slope is the first divided by the second. The value answers a single question: for each unit you travel to the right, how many units do you move up? A slope of 2 means two units up for every one across, which is what the calculator returns for (1, 2) and (4, 8) — a rise of 6 over a run of 3.

Because the value is a ratio rather than a count, it survives any pair of points you choose on the same line. (1, 2) to (4, 8) returns 2; so do (0, −3) to (4, 5), (−2, −5) to (4, 7) and (2, 1) to (5, 7), even though their rises are 6, 8, 12 and 6 and their distances are 6.7082, 8.9443, 13.4164 and 6.7082. The rises differ, the ratios do not.

Order is also free. Running (1, 2) to (4, 8) shows the working as 6/3, and running (4, 8) to (1, 2) shows it as −6/−3. Both differences change sign together, the two minus signs cancel in the division, and the slope stays 2.

The Four Kinds of Slope

Every pair of distinct points falls into one of four cases, and the calculator's last line names which one you are in.

The fourth case is the one that trips people, and it is worth being blunt about: the slope of a vertical line is not zero and it is not infinity. It does not exist. The run is 0, and dividing by 0 produces no number at all, so the honest output is a word rather than a value. Zero belongs to the opposite case — a horizontal line, where the rise is 0 and the division is perfectly legal.

  • Positive — the line rises left to right. (0, 0) to (1, 3) returns m = 3 and the note "Rising left to right".
  • Negative — the line falls left to right. (1, 5) to (4, −4) returns m = −3, an angle of −71.5651°, and "Falling left to right".
  • Zero — the line is horizontal. (1, 3) to (7, 3) returns m = 0, the equation y = 0x + 3, an angle of 0° and the note "Horizontal (slope 0)".
  • Undefined — the line is vertical. (2, 1) to (2, 7) returns "Undefined (vertical line)" with the explanation "Rise 6 over run 0 — the line x = 2 is vertical".

That is also why a vertical line cannot be written as y = mx + b. There is no m to put in it. Vertical lines are written x = c instead, and the calculator says so directly: it prints the line as x = 2 for the points above, and x = −3 for (−3, 5) to (−3, −2).

Gradient, Grade and Pitch: One Number, Several Vocabularies

Outside a maths class the same quantity travels under other names, and the conversions between them are pure arithmetic rather than new mathematics.

  • Gradient — the word used in British schooling and in calculus for the same m.
  • Percent grade — slope × 100, the form on highway signs. A 6% grade is m = 0.06, which this calculator returns for (0, 0) to (100, 6) along with an angle of 3.4336°.
  • Ratio, written 1:12 or 1 in 12 — one unit of rise per twelve of run, which is m = 0.0833 and an angle of 4.7636°.
  • Roof pitch, written X-in-12 — rise per twelve units of run. A 6/12 pitch is m = 0.5, from (0, 0) to (12, 6), at 26.5651°.
  • Rate of change — the slope of a line fitted to data, where m carries the units of the axes: dollars per hour, degrees per minute, miles per gallon.

The 1:12 and X-in-12 forms are ordinary ratios once you strip the vocabulary away, and converting between them, scaling them, or simplifying an awkward pair like 7:11 is quicker in the Ratio Calculator.

One conversion causes more confusion than the rest: a 100% grade is 45°, not vertical. Percent grade is rise over run times 100, so equal rise and run give 100%, which the calculator confirms by returning m = 1 and 45° for (0, 0) to (100, 100). Grades above 100% exist and are steeper still — m = 2 is a 200% grade at 63.4349°.

How Do You Calculate Slope?

One subtraction on each axis, then a single division. Everything else this page reports — the equation of the line, the incline angle, the distance between the points — is built from those two differences after the slope is already known.

The Slope Formula, Written Out

The slope formula takes the two y values, takes the two x values, subtracts each pair in the same order, and divides. The three lines beneath it are what the calculator adds once m exists: the intercept comes from rearranging the slope-intercept form, the angle from MathWorld's identity m = tan θ, and the distance from the Pythagorean theorem applied to the same two differences.

SLOPE
m = (y₂ − y₁) ÷ (x₂ − x₁)

INTERCEPT AND LINE
b = y₁ − m · x₁       →   y = mx + b

ANGLE
θ = arctan(m), in degrees

DISTANCE BETWEEN THE POINTS
d = √( (x₂ − x₁)² + (y₂ − y₁)² )

"In the same order" is the whole discipline of the formula. Subtracting y₁ from y₂ on top while subtracting x₂ from x₁ underneath flips the sign of the answer and turns a climb into a fall, with nothing on screen to warn you. Keeping the second point second in both subtractions makes the order irrelevant, which is why (1, 2) to (4, 8) and (4, 8) to (1, 2) both return 2.

The fourth line is not really a separate formula. Rise and run are the two legs of a right triangle and the segment joining your points is its hypotenuse, so the distance output is the theorem you will find in the Pythagorean Theorem Calculator.

MathWorld's slope-intercept form y = mx + b is the second line's destination, and its two-point form y − y₁ = ((y₂ − y₁)/(x₂ − x₁))(x − x₁) is the same statement before the intercept has been separated out. This calculator finishes the rearrangement for you and prints the result in slope-intercept form.

Step by Step With This Calculator

Four boxes, in reading order: the first point's coordinates, then the second point's. All four accept negatives and decimals.

The page arrives pre-filled with 1, 2, 4 and 8 and already showing its answer, so the output format is visible before you type anything. That first run happens once, as the page loads: replace any of the four values and press Calculate to see the new result. Reset returns the boxes to those same four defaults and empties the panel.

  • Point 1 — x₁: the horizontal coordinate of the first point.
  • Point 1 — y₁: its vertical coordinate.
  • Point 2 — x₂: the horizontal coordinate of the second point.
  • Point 2 — y₂: its vertical coordinate.
  • Read the four output lines: the slope, the subtraction that produced it, a line combining the equation with the angle and the distance, and a one-phrase verdict on the direction.

Two formatting rules matter. Type a minus sign directly into the box for negative coordinates — (−2, 4) to (2, −4) returns m = −2 — and never type a thousands separator. A value entered as 1,000 is not a number the tool can read, and it answers "Enter all four coordinates (negatives fine)" instead of calculating. Write 1000.

Worked Example: (1, 2) to (4, 8)

The default inputs, worked by hand and then checked against the panel. x₁ = 1, y₁ = 2, x₂ = 4, y₂ = 8.

Rise      y₂ − y₁ = 8 − 2 = 6
Run       x₂ − x₁ = 4 − 1 = 3
Slope     m = 6 ÷ 3 = 2
Intercept b = y₁ − m·x₁ = 2 − 2×1 = 0
Line      y = 2x + 0
Angle     arctan(2) = 63.4349°
Distance  √(3² + 6²) = √45 = 6.7082
What the result panel returns
m = 2 · Rise ÷ run: (8 − 2) ÷ (4 − 1) = 6/3 · Line: y = 2x + 0 · Angle: 63.4349° · Distance: 6.7082 · Rising left to right

The intercept lands on 0 here, which is a coincidence of these particular points rather than a rule. Shift the same line one unit right and one unit down — (2, 1) to (5, 7) — and the slope is still 2 while the equation becomes y = 2x − 3. The pair (−1, −3) to (2, 3) gives y = 2x − 1, and (0, −3) to (4, 5) gives y = 2x − 3 again, because those points sit on the same line as (2, 1) to (5, 7). Four pairs of points, one slope, three lines and three intercepts: 0, −3 and −1.

The intercept can be checked without the calculator. Put x = 0 into y = 2x + 0 and you get y = 0, so the line crosses the y-axis at the origin; put x = 0 into y = 2x − 3 and you get −3, which is where that parallel line crosses instead.

Worked Example: A Line That Falls, (5, 1) to (2, 7)

Now with the second point to the left of the first, which makes the run negative — the arrangement most likely to produce a sign error by hand. x₁ = 5, y₁ = 1, x₂ = 2, y₂ = 7.

Rise      y₂ − y₁ = 7 − 1 = 6
Run       x₂ − x₁ = 2 − 5 = −3
Slope     m = 6 ÷ −3 = −2
Intercept b = y₁ − m·x₁ = 1 − (−2)(5) = 11
Line      y = −2x + 11
Angle     arctan(−2) = −63.4349°
Distance  √((−3)² + 6²) = 6.7082
What the result panel returns
m = -2 · Rise ÷ run: (7 − 1) ÷ (2 − 5) = 6/-3 · Line: y = -2x + 11 · Angle: -63.4349° · Distance: 6.7082 · Falling left to right

A positive rise over a negative run is a falling line, and the visible 6/-3 in the second output line is the fastest way to confirm the calculator read your boxes the way you meant them. The negative angle is not an error either: arctan returns −63.4349° for m = −2, the mirror image of the +63.4349° that m = 2 produced above.

The distance is identical to the previous example at 6.7082, because squaring erases the sign of the run. Distance never goes negative; only the slope and the angle carry direction.

From Slope to the Equation y = mx + b

Once m is known, one point supplies the intercept. Substitute the point into y = mx + b and rearrange to b = y₁ − m·x₁, which is what the calculator does before printing the finished line. Either point works and both give the same b — that is a useful check on your own arithmetic.

Given (1, 1) and (4, 3):

m = (3 − 1) ÷ (4 − 1) = 2/3, shown as 0.6667
b from point 1:  1 − (2/3)×1 = 1/3, shown as 0.3333
b from point 2:  3 − (2/3)×4 = 3 − 8/3 = 1/3, shown as 0.3333
Line: y = 0.6667x + 0.3333

The tool prints the equation exactly as assembled, without tidying it. A slope of 1 appears as y = 1x rather than y = x, and a zero intercept appears as + 0 rather than being dropped — (0, 0) to (1, 1) returns "Line: y = 1x + 0". Horizontal lines keep the same shape, so (2, 5) to (6, 5) prints y = 0x + 5, which reads oddly but is the correct statement that y is 5 everywhere.

Vertical lines are the exception the form cannot hold, and the calculator does not force them into it. For (3, 7) to (3, 2) it reports the line as x = 3, the distance as 5, and adds the reminder that vertical lines have no slope value while horizontal lines have slope 0.

Slope Examples, Worked Out

Every figure in this section came from the calculator at the top of this page, run on the exact coordinates shown in the first column.

Point Pairs and Their Slopes

A spread of positive, negative, zero and undefined cases, with the full output for each.

Points enteredSlope mLineAngleDistance
(1, 2) → (4, 8)2y = 2x + 063.4349°6.7082
(2, 1) → (5, 7)2y = 2x − 363.4349°6.7082
(0, 0) → (1, 1)1y = 1x + 045°1.4142
(0, 0) → (4, 3)0.75y = 0.75x + 036.8699°5
(1, 1) → (4, 3)0.6667y = 0.6667x + 0.333333.6901°3.6056
(0, 0) → (3, 1)0.3333y = 0.3333x + 018.4349°3.1623
(1, 3) → (7, 3)0y = 0x + 36
(0, 3) → (6, 0)−0.5y = −0.5x + 3−26.5651°6.7082
(2.5, 4) → (7.5, 1)−0.6y = −0.6x + 5.5−30.9638°5.831
(1, 5) → (4, −4)−3y = −3x + 8−71.5651°9.4868
(2, 1) → (2, 7)Undefinedx = 26
(3, 3) → (3, 3)No answer

The last two rows are the tool's two non-numeric outcomes. Equal x values give the vertical-line message with the distance still reported; two identical points give "The two points are identical — no unique line", because infinitely many lines pass through a single point and none of them is preferred.

Examples With Negative Coordinates

Negative coordinates change nothing about the method, but they do produce double minus signs in the printed subtraction, which is where hand-worked answers most often go wrong.

Rows two and three are the same line sampled at different points: both return m = 2 and the equation y = 2x − 1, though the distances between the pairs are 6.7082 and 13.4164. Rows four and five are genuinely different lines that happen to share a slope — 0.75 in both cases — and the intercepts, 0.25 and 0.5, are what separate them.

Points enteredSubtraction shownSlope mLine
(−2, 4) → (2, −4)(-4 − 4) ÷ (2 − -2) = -8/4−2y = −2x + 0
(−1, −3) → (2, 3)(3 − -3) ÷ (2 − -1) = 6/32y = 2x − 1
(−2, −5) → (4, 7)(7 − -5) ÷ (4 − -2) = 12/62y = 2x − 1
(−3, −2) → (5, 4)(4 − -2) ÷ (5 − -3) = 6/80.75y = 0.75x + 0.25
(−6, −4) → (2, 2)(2 − -4) ÷ (2 − -6) = 6/80.75y = 0.75x + 0.5
(4, −1) → (−2, 5)(5 − -1) ÷ (-2 − 4) = 6/-6−1y = −1x + 3
(−5, 2) → (5, 2)(2 − 2) ÷ (5 − -5) = 0/100y = 0x + 2
(−3, 5) → (−3, −2)Rise -7 over run 0Undefinedx = −3

Subtracting a negative widens a gap rather than narrowing it, which is the arithmetic behind every 6/3 and 12/6 above. If a hand calculation and the calculator disagree, compare against the printed subtraction line first: it shows the four values exactly as the tool read them.

Parallel and Perpendicular Pairs

Two lines are parallel when their slopes are equal and perpendicular when the slopes multiply to −1, which makes each the negative reciprocal of the other. Both facts are checkable one pair of points at a time.

The angles confirm each pair independently. The perpendicular slopes 2 and −0.5 return 63.4349° and −26.5651°, which are 90° apart; 0.75 and −1.3333 return 36.8699° and −53.1301°, again 90° apart. The parallel pair returns 63.4349° twice, with only the intercepts differing — y = 2x + 0 against y = 2x + 5.

First linem₁Second linem₂m₁ × m₂Relationship
(0, 0) → (1, 2)2(0, 5) → (1, 7)2Parallel
(1, 2) → (4, 8)2(0, 0) → (2, −1)−0.5−1Perpendicular
(0, 0) → (4, 3)0.75(0, 0) → (3, −4)−1.3333−1Perpendicular
(0, 0) → (3, 2)0.6667(0, 0) → (2, −3)−1.5−1Perpendicular
(0, 0) → (1, 1)1(0, 0) → (1, −1)−1−1Perpendicular
(1, 3) → (7, 3)0(2, 1) → (2, 7)UndefinedPerpendicular

The last row is the case the multiplication rule cannot express. A horizontal line and a vertical line meet at a right angle, but one slope is 0 and the other does not exist, so there is no product to test. Geometry is right and the shortcut simply has a hole in it.

Slope Chart: Angles, Grades and Pitches

Slope is quoted as a decimal in algebra, as degrees by surveyors, as a percentage on road signs, as a ratio in accessibility codes and as rise-in-12 by roofers. These charts line the five up, and every angle and distance in them was produced by running the calculator on the coordinates named in each section.

Slope to Angle

The slope and angle in each row are the calculator's output for the pair of points in the second column; the last column is a plain-language gloss. Most rows start at (0, 0) and reach a second point whose rise and run give the slope named in the first column, while the level row and the vertical row use points placed away from the origin. The vertical row is the exception: the calculator returns no angle for it, which is why that cell holds a dash.

The relationship is compressive, not proportional. Going from m = 0 to m = 1 buys 45 degrees; going from m = 1 to m = 100 buys only 44.4271 more. Doubling a shallow slope nearly doubles its angle — 0.05 to 0.1 moves 2.8624° to 5.7106° — while doubling a steep one barely moves it, with 5 to 10 gaining just 5.5993°.

Slope mPoints enteredAngleWhat it looks like
0(1, 3) → (7, 3)Level
0.05(0, 0) → (20, 1)2.8624°A long highway climb
0.1(0, 0) → (10, 1)5.7106°A demanding cycling gradient
0.25(0, 0) → (4, 1)14.0362°A shallow roof
0.3333(0, 0) → (3, 1)18.4349°A 4-in-12 roof
0.5(0, 0) → (2, 1)26.5651°A 6-in-12 roof
0.75(0, 0) → (4, 3)36.8699°Steeper than most stairs
1(0, 0) → (1, 1)45°Rise equals run
1.5(0, 0) → (2, 3)56.3099°A steep gable
2(0, 0) → (1, 2)63.4349°Steeper than almost any roof
3(0, 0) → (1, 3)71.5651°Near-cliff
5(0, 0) → (1, 5)78.6901°Almost upright
10(0, 0) → (1, 10)84.2894°Visually vertical
100(0, 0) → (1, 100)89.4271°Indistinguishable from vertical
Undefined(2, 1) → (2, 7)Vertical

The numeric rows have no natural last entry. Slope can grow without limit and the angle creeps toward 90° without ever arriving, which is the geometric reason a vertical line has no slope: there is no number the tangent of 90° could be. Enter a run of 0.00001 with a rise of 1 and the calculator returns m = 100000 at 89.9994°, still not vertical.

Slope as a Percent Grade

Percent grade is slope × 100 — rise per hundred units of run. Each row below is the calculator's output for (0, 0) to (100, rise).

The percentages that appear on road signs sit in the top third of that table, and they are not chosen arbitrarily. The 2009 edition of the Federal Highway Administration's Manual on Uniform Traffic Control Devices, section 2C.16, advises a Hill sign with a grade plaque in advance of a 5% grade longer than 3,000 feet, a 6% grade longer than 2,000 feet, a 7% grade longer than 1,000 feet, an 8% grade longer than 750 feet, or a 9% grade longer than 500 feet.

Percent gradeSlope mRise per 100 ft of runAngle
1%0.011 ft0.5729°
2%0.022 ft1.1458°
3%0.033 ft1.7184°
4%0.044 ft2.2906°
5%0.055 ft2.8624°
6%0.066 ft3.4336°
7%0.077 ft4.0042°
8%0.088 ft4.5739°
9%0.099 ft5.1428°
10%0.110 ft5.7106°
12%0.1212 ft6.8428°
15%0.1515 ft8.5308°
20%0.220 ft11.3099°
25%0.2525 ft14.0362°
30%0.330 ft16.6992°
35%0.3535 ft19.29°
50%0.550 ft26.5651°
100%1100 ft45°

Read as slopes, those five thresholds are m = 0.05, 0.06, 0.07, 0.08 and 0.09 — angles of 2.8624°, 3.4336°, 4.0042°, 4.5739° and 5.1428°. The steepest of them is barely five degrees. A grade that feels alarming from behind the wheel is, in the geometry, an almost flat line, which is exactly why the signs quote a percentage instead of an angle: the percentage moves through a usefully wide range where the angle hardly moves at all.

Notice too that the trigger length shortens as the grade steepens, from 3,000 feet at 5% down to 500 feet at 9%. The hazard is not the slope alone but the total descent, and a steeper grade reaches the same drop in less distance.

Slope as a Ratio: 1 in 12 and Its Neighbors

Accessibility and drainage codes state slope as a ratio of rise to run, written 1:12 or 1 in 12. Each row is the calculator's output for (0, 0) to (run, 1).

Two rows in that table are legal limits rather than round numbers. The ADA Accessibility Standards published by the U.S. Access Board require, in section 405.2, that a ramp's running slope be no steeper than 1:12, and in section 405.3 that its cross slope — the sideways tilt across the direction of travel — be no steeper than 1:48. Those are m = 0.0833 and m = 0.0208, or 4.7636° and 1.1935°.

RatioPoints enteredSlope mPercent gradeAngle
1:48(0, 0) → (48, 1)0.02082.08%1.1935°
1:20(0, 0) → (20, 1)0.055%2.8624°
1:16(0, 0) → (16, 1)0.06256.25%3.5763°
1:12(0, 0) → (12, 1)0.08338.33%4.7636°
1:10(0, 0) → (10, 1)0.110%5.7106°
1:8(0, 0) → (8, 1)0.12512.5%7.125°
1:6(0, 0) → (6, 1)0.166716.67%9.4623°
1:4(0, 0) → (4, 1)0.2525%14.0362°
1:2(0, 0) → (2, 1)0.550%26.5651°
1:1(0, 0) → (1, 1)1100%45°

Section 405.6 caps the rise of a single ramp run at 30 inches. At the 1:12 maximum that fixes the longest compliant run: enter (0, 0) and (360, 30) and the calculator returns m = 0.0833 at 4.7636°, with the ramp surface itself measuring 361.2478 inches — just over 30 feet of ramp for 30 inches of climb.

The gap between 1:12 and 1:48 is worth holding onto, because the two numbers govern perpendicular directions of the same surface. A ramp may climb at 8.33% along its length while being required to stay within 2.08% across its width.

Slope as Roof Pitch: X-in-12

Roof pitch is rise per 12 units of run, so entering (0, 0) and (12, rise) gives the slope directly — and the distance the calculator returns is the sloping length of the roof per 12 units of horizontal run.

The fourth column is the useful one and it is free: it is the distance output, which measures the segment from (0, 0) to (12, rise) — the rafter line above a 12-unit run. A 5/12 roof gives exactly 13 because 5, 12 and 13 form a Pythagorean triple, and 9/12 gives exactly 15 for the same reason, being the 3-4-5 triple scaled by three.

PitchSlope mAngleSloping length per 12 of run
1/120.08334.7636°12.0416
2/120.16679.4623°12.1655
3/120.2514.0362°12.3693
4/120.333318.4349°12.6491
5/120.416722.6199°13
6/120.526.5651°13.4164
7/120.583330.2564°13.8924
8/120.666733.6901°14.4222
9/120.7536.8699°15
10/120.833339.8056°15.6205
12/12145°16.9706
18/121.556.3099°21.6333
24/12263.4349°26.8328

Stairs work the same way with different conventions. A stair with a 7-inch rise and an 11-inch tread is (0, 0) to (11, 7): m = 0.6364 at 32.4712°, with a diagonal of 13.0384 inches per step. Steepen the rise to 7.75 inches over a 10-inch tread and the same calculation gives m = 0.775 at 37.7757° — five degrees of difference that is immediately obvious underfoot.

Note how narrow the usable band is. Nearly every pitched roof and every staircase you will ever walk on sits between m = 0.25 and m = 1, which is 14° to 45°. Outside that range you are looking at a nearly flat roof or a ladder.

How to Read Your Result

The panel returns four lines. There are no bands or categories to interpret, so reading the result is mostly a matter of knowing what each line is for and which of them can quietly mislead you.

The Four Lines the Panel Returns

Running the default points (1, 2) and (4, 8) produces these, in order:

Only the first and third lines describe the line. The second and fourth describe your input and its direction, and the distance is the one output that belongs to your two specific points rather than to the line they define — choose a different pair on the same line and the slope, equation and angle are unchanged while the distance is not.

  • The slope itself, as m = 2. This is the headline number and the only one on the page that describes the whole line rather than your particular pair of points.
  • The subtraction, with your own values in it: (8 − 2) ÷ (4 − 1) = 6/3. Check this line first when an answer looks wrong — it shows exactly which four numbers the tool read from the boxes.
  • A combined line carrying the equation, the angle and the distance: y = 2x + 0 · Angle: 63.4349° · Distance: 6.7082.
  • A one-phrase verdict on direction: "Rising left to right", "Falling left to right" or "Horizontal (slope 0)".

If the distance is the number you actually came for, and you would rather work in map coordinates or see the midpoint of the segment as well, that job has its own tool in the Distance Calculator.

What the Sign Tells You

A positive slope rises left to right, a negative slope falls, and the magnitude says how fast. The sign also propagates to the angle, so a falling line reports a negative one: (2.5, 4) to (7.5, 1) returns m = −0.6 with an angle of −30.9638°, and (1, 5) to (4, −4) returns m = −3 at −71.5651°.

The magnitude is where the units live when the axes mean something. A line through (0, 32) and (100, 212) returns m = 1.8 and the equation y = 1.8x + 32 — the Celsius-to-Fahrenheit conversion, where 1.8 is degrees F per degree C and 32 is the intercept. A line through (0, 50) and (10, 130) returns m = 8 with y = 8x + 50, which reads as a fixed 50 plus 8 per unit.

The reported angle is worth ignoring in cases like those. It is computed as arctan of the raw number, so the temperature line comes back as 60.9454° and the pricing line as 82.875°, both meaningless — an angle only means something when the two axes carry the same units and the same scale.

Rounding: Why One-Twelfth Prints as 0.0833

Every number in the output is rounded to four decimal places, with trailing zeros dropped. A slope of one-twelfth prints as 0.0833, one-third as 0.3333, and two-thirds as 0.6667. The underlying arithmetic is not rounded — only the display is — so the intercept and angle are computed from the full value before being trimmed themselves.

That produces one genuinely misleading case at the shallow end. A slope smaller than 0.00005 rounds to 0, so (0, 0) to (25000, 1) prints m = 0 while still reporting an angle of 0.0023° and the verdict "Rising left to right" — the line is not horizontal, its slope is merely too small to survive four decimal places. Widen the run a little and (0, 0) to (20000, 1) prints m = 0.0001 instead.

There is a matching quirk at the steep end. The second output line rounds your own coordinates as well, so a run of 0.00001 prints as "(1 − 0) ÷ (0 − 0) = 1/0" — which looks like a division by zero and is not one. The slope on the first line is m = 100000, calculated from the true run.

The Three Messages That Replace an Answer

Three inputs return words instead of a slope, and each says something different about your points.

A fourth case produces no message at all, and it is the one to watch for: a blank box is read as 0 rather than rejected. Clearing x₁ while the others hold 2, 4 and 8 does not raise an error — it silently computes (0, 2) to (4, 8) and returns m = 1.5 with the line y = 1.5x + 2.

  • "Undefined (vertical line)" — your two x values are equal. The tool still reports the vertical line's equation, such as x = 2, and the distance between the points, and reminds you that vertical lines have no slope value while horizontal lines have slope 0.
  • "The two points are identical — no unique line" — both coordinates match, as in (3, 3) to (3, 3). One point does not determine a line, so there is nothing to compute.
  • "Enter all four coordinates (negatives fine)" — at least one box holds something that is not a number. A thousands separator is the usual culprit: 1,000 triggers this message, 1000 does not.

Clearing every box is the one blank that does complain, because four zeros make two identical points at the origin and the tool returns the identical-points message. Any answer that arrives without a complaint is still worth checking against the printed subtraction line.

Limits: When This Calculator Does Not Apply

This tool measures the constant slope of a straight line through two points on a plane. Being precise about the edges of that job is more useful than a longer list of things it does not do.

  • It does not do curves. A parabola or any other curve has a different slope at every point, and two points on it give only the average rate of change between them — the chord, not the tangent. Finding the slope at a point on a curve is differentiation.
  • It has no third dimension. There is no z box, so a slope that combines a ground run with a rise in two horizontal directions has to be reduced to a single run first.
  • It fits a line rather than data. Feeding it two data points gives the slope through exactly those two, which is not a regression line: least-squares fitting uses every point, and two cherry-picked ones can imply almost any trend. The pair (2010, 32000) to (2020, 47500) returns m = 1550 per year, but that is the average across the decade, not evidence about any year inside it.
  • It cannot return a slope for a vertical line, and no rearrangement will make it. The output is the word "undefined", not a very large number.
  • It does not simplify what it prints. A slope of 1 appears as y = 1x and a zero intercept as + 0, so the equation is correct but not in the tidiest form you would write by hand.
  • It rounds to four decimal places. Slopes below 0.00005 display as 0 even though the direction line correctly reports the line as rising or falling.
  • It reads a blank box as 0 instead of refusing to calculate, so an incomplete form can still return a confident, wrong answer.
  • It rejects thousands separators, degree symbols and any other non-numeric character, answering "Enter all four coordinates (negatives fine)" rather than attempting to interpret them.
  • The angle it reports is geometric. It is meaningful only when both axes use the same units and scale — an angle computed for dollars against hours is arithmetic without meaning.

The first limit is the one that sends most people elsewhere. If your relationship bends instead of running straight, what you usually want is not a slope at all but the roots of the equation — and whether they come out real, repeated or complex, which is the job of the Quadratic Equation Solver.

Two things that look like limits are not. Very large coordinates are handled without trouble — (0, 0) to (1000000, 1000000) returns m = 1 at 45° with a distance of 1414213.5624 — and the order of the two points never matters, because both differences change sign together and the quotient is unaffected.

Frequently Asked Questions

What is the slope formula?

m = (y₂ − y₁) ÷ (x₂ − x₁) — the change in y divided by the change in x. For (1, 2) and (4, 8) that is (8 − 2) ÷ (4 − 1) = 6/3 = 2. Subtract in the same order on top and bottom; reversing one and not the other flips the sign of the answer.

How do you calculate slope from two points?

Subtract the y values, subtract the x values in the same order, and divide. Entering 1, 2, 4 and 8 runs exactly those steps and returns m = 2, along with the line y = 2x + 0, an angle of 63.4349° and a distance of 6.7082 between the points.

What is the slope of a vertical line?

Undefined. The run is zero and division by zero produces no number, so (2, 1) to (2, 7) returns "Undefined (vertical line)" rather than a value. It is not infinity and not zero — zero is a horizontal line, which returns m = 0 for points like (1, 3) and (7, 3).

How do I get the equation of the line from the slope?

Solve b = y₁ − m·x₁ from either point, then write y = mx + b. With m = 2 through (2, 1): b = 1 − 2×2 = −3, giving y = 2x − 3. The calculator does both steps, so (2, 1) to (5, 7) prints the finished equation directly.

How do I convert slope to an angle?

The angle is arctan(m). Slope 0.1 is 5.7106°, slope 1 is 45°, slope 2 is 63.4349° and slope 10 is 84.2894°. The relationship compresses at the steep end: going from m = 1 to m = 100 adds only 44.4271°, while 90° is never reached at all.

How do I convert slope to a percent grade?

Multiply by 100. A slope of 0.06 is a 6% grade, which the calculator returns for (0, 0) to (100, 6) at an angle of 3.4336°. A 100% grade is 45°, not vertical — equal rise and run — and grades above 100% are steeper still.

What slope do perpendicular lines have?

Negative reciprocals, whose product is −1. Perpendicular to m = 2 is m = −0.5, returned by (0, 0) to (2, −1); their angles are 63.4349° and −26.5651°, exactly 90° apart. The exception is a horizontal line and a vertical one, which meet at a right angle although one slope is 0 and the other undefined.

Do parallel lines have the same slope?

Yes, and only the intercept differs. (0, 0) to (1, 2) and (0, 5) to (1, 7) both return m = 2 and the same 63.4349° angle, but the equations come out as y = 2x + 0 and y = 2x + 5.

What does a negative slope mean?

The line falls left to right: y decreases as x increases. (1, 5) to (4, −4) returns m = −3, an angle of −71.5651° and the note "Falling left to right" — three units of drop for every unit rightward.

Does it matter which point I enter first?

No. (1, 2) to (4, 8) shows the working as 6/3 and (4, 8) to (1, 2) shows it as −6/−3, and both return m = 2 with the same angle and distance. Both differences change sign together, so the quotient is unchanged.

What is the maximum slope for a wheelchair ramp?

1:12, which is m = 0.0833 or 8.33%, at an angle of 4.7636°. The ADA Accessibility Standards set that running-slope limit in section 405.2 and cap the cross slope at 1:48 (m = 0.0208, 1.1935°) in 405.3, with a single run rising no more than 30 inches.

Why does my slope show as 0 when the line clearly rises?

Because the display rounds to four decimal places and your slope is below 0.00005. Entering (0, 0) and (25000, 1) prints m = 0 while still reporting an angle of 0.0023° and "Rising left to right". The line is not horizontal; the number is simply too small to show.

Sources & References

  1. [1] Weisstein, E.W. Slope — Wolfram MathWorld
  2. [2] Weisstein, E.W. & Stover, C. Line — slope-intercept form y = mx + b and the two-point form — Wolfram MathWorld
  3. [3] ADA Accessibility Standards, Section 405 Ramps (405.2 running slope 1:12; 405.3 cross slope 1:48; 405.6 rise 30 in maximum) — U.S. Access Board
  4. [4] (2009). Manual on Uniform Traffic Control Devices, Part 2C — Section 2C.16, Hill (W7-1) sign and grade plaque thresholds — Federal Highway Administration, U.S. Department of Transportation

Methodology. This calculator uses standard, peer-reviewed mathematical formulas. It is reviewed and maintained by the Vast Calculators editorial team.

Last updated ·

Results are estimates for general use; verify critical figures independently.

What to Work Out Next

See all Math Calculators