Skip to main content
Viralrang
MathFree · no sign-up

Slope Calculator

Two points in, the whole line out — slope, equation, intercepts, distance and midpoint.

Updated

The line through both points

2slope

Rise 6 over run 3.

Equation
y = 2x
y-intercept
0
x-intercept
0
Angle of inclination
63.4349°
Distance between the points
6.7082
Midpoint
(2.5000, 5)

In short

How do you find the slope between two points?

Subtract the y values, subtract the x values in the same order, and divide. From (1, 2) to (4, 8) the rise is 6 and the run is 3, so the slope is 2. Reversing both points gives the same answer, because both signs flip.

When the run is zero the line is vertical and the slope is undefined — not infinite, and not zero.

How to use the slope calculator

Slope measures how steeply a line climbs: the change in y divided by the change in x, usually said as rise over run. From (1, 2) to (4, 8) the line climbs 6 while moving across 3, so the slope is 2 — every step right lifts it two steps up. A negative slope falls instead, and a slope of zero is flat.

The order of the two points does not matter as long as it is consistent. Taking the second point first flips the sign of both the rise and the run, and a negative divided by a negative is positive again. What does matter is not mixing them: subtracting y in one order and x in the other gives the slope with the wrong sign, and nothing about the answer will look suspicious.

2

Slope from (1,2) to (4,8)

rise 6 over run 3

0

Slope of a horizontal line

a real number

Slope of a vertical line

undefined, not infinite

That last distinction is worth being firm about. A vertical line has a run of exactly zero, and division by zero is undefined rather than infinite. Calling it "infinite slope" is informal limiting language: as a line tips towards vertical its slope grows without bound, but at vertical there is no value at all. The line still exists and is written x = 3 instead.

The angle of inclination is the one figure with a convention attached. It is measured counterclockwise from the positive x axis and runs from 0 up to but not including 180 degrees, so a line falling at 45 degrees has an inclination of 135 rather than −45. Taking arctan of the slope directly gives the wrong answer for every negative slope.

The three forms of a line
Slope-intercept
y = mx + b
Point-slope
y − y₁ = m(x − x₁)
Standard
Ax + By = C
Vertical line
x = a — only standard form can write it
Horizontal line
y = b, with m = 0

Slope-intercept is the most readable and cannot express a vertical line at all, since it needs a value for m. That limitation is a fact about the notation rather than about the line.

Curves, when a straight line will not do

A parabola has a different slope at every point. The quadratic page finds where one crosses the x axis and where its turning point sits.

Open the quadratic calculator

Point pairs with the slope, the angle of inclination and the equation of the line each one determines, including the two cases that break the usual form.

From → toSlopeAngle / equation
(1,2) → (4,8)263.43° / y = 2x
(0,0) → (1,1)145° / y = x
(0,0) → (1,−1)−1135° / y = −x
(0,3) → (2,7)263.43° / y = 2x + 3
(1,5) → (9,5)00° / y = 5
(3,1) → (3,9)undefined90° / x = 3
(0,0) → (12,1)0.08334.76° / y = 0.0833x
(2,4) → (6,2)−0.5153.43° / y = −0.5x + 5
(−2,−3) → (2,5)263.43° / y = 2x + 1
(0,4) → (4,0)−1135° / y = −x + 4
Angles are inclinations measured counterclockwise from the positive x axis over 0 to 180 degrees, rounded to two decimal places.

Slope outside the coordinate plane

Every real gradient is a slope: a roof pitch, a wheelchair ramp, a railway grade, a road sign warning of a descent. Road signs use percentages, which is slope multiplied by a hundred — an eight percent grade rises eight metres over a hundred travelled. Roofs are quoted as a rise over a twelve-unit run, so a 6:12 pitch is a slope of 0.5.

The same steepness in four notations
As a slope
0.0833
As a ratio
1 : 12
As a percentage
8.33%
As an angle
4.76°
One line
four ways of quoting it

The angle is the one that is not a simple rescaling of the others: it comes from arctan rather than from multiplication, which is why a doubling of the slope does not double the angle. At small slopes they track closely and they separate quickly above about twenty percent.

Ramp and access requirements are usually written as ratios for this reason — a ratio is checkable with a tape measure and an angle is not. Where a specific figure is required by regulation, take it from the regulation rather than from a conversion, because permitted maxima vary by application and by whether the work is new or existing.

Parallel, perpendicular, and the negative reciprocal

Two lines are parallel when their slopes are equal — same steepness, different position. They are perpendicular when the product of their slopes is exactly −1, which means each slope is the negative reciprocal of the other. A line of slope 2 is crossed at a right angle by a line of slope −0.5.

Do

  • Subtract the coordinates in the same order for both axes
  • Write a vertical line as x = a rather than forcing y = mx + b
  • Add 180 degrees when converting a negative slope to an inclination
  • Take regulatory gradient limits from the regulation itself

Don't

  • Call a vertical slope infinite
  • Mix the order of subtraction between x and y
  • Assume arctan alone gives the angle of inclination
  • Confuse a slope of zero with an undefined slope

The perpendicular rule has one exception, and it is the same one as everywhere else on this page: a vertical and a horizontal line are perpendicular, but their slopes are undefined and zero, and no product of those two equals −1. The rule works for every pair except the one that includes a vertical line.

The formula, worked line by line

One division for the slope, and five more formulas that fall out of the same two points without any further measurement.

Rise over run. The only thing that can go wrong is subtracting in one order on top and the other underneath, and the answer will not look wrong when you do.
The one error worth guarding against

That silence is what makes it worth a deliberate habit: write both subtractions the same way round every time, even when the numbers are easy enough to do in your head.

slope m = (y₂ − y₁) ÷ (x₂ − x₁)
y-intercept b = y₁ − m × x₁
equation: y = mx + b
distance = √((x₂ − x₁)² + (y₂ − y₁)²)
midpoint = ((x₁ + x₂) ÷ 2, (y₁ + y₂) ÷ 2)
Rise over runFrom (1, 2) to (4, 8) the line rises 6 while running 3 across, so the slope is 2 and the equation is y = 2x.RISE ÷ RUNrun 3rise 6(1, 2)(4, 8)THE MATHrise6run3angle63.4°slope2
Rise over run between two points, with the angle of inclination marked.
Everything from (−2, −3) to (2, 5)
Rise
5 − (−3) = 8
Run
2 − (−2) = 4
Slope
8 ÷ 4 = 2
y-intercept
−3 − 2 × (−2) = 1
Distance
√(16 + 64) = 8.944
Equation
y = 2x + 1

The distance formula is the Pythagorean theorem in disguise: the run and the rise are the two short sides of a right triangle and the distance is its hypotenuse. Recognising that means never having to memorise it separately.

Why the sign of the slope tells you the direction

A positive slope rises left to right; a negative slope falls. The magnitude says how fast: a slope of 5 is five times steeper than a slope of 1, and a slope of 0.2 is five times shallower. Values between −1 and 1 describe lines closer to horizontal than to vertical, which is a useful sense check when a figure looks surprising.

Gradient and slope

Same quantity, different vocabulary
Slope
the usual term in US materials
Gradient
the usual term in UK materials
Grade
civil engineering, quoted as a percentage
Pitch
roofing, quoted as rise over a run of 12
All of them
rise divided by run

The preference is regional rather than exclusive — both words appear in both places, and neither is more correct. Only the notation changes: a percentage, a ratio or a decimal, all measuring the same thing.

The one that reads differently is pitch, because its run is fixed at twelve by convention rather than being whatever the horizontal distance happens to be. A 6:12 pitch is a slope of one half, and a 12:12 pitch is a slope of one, which is 45 degrees.

Questions people ask

Sources

Where the constants and formulas on this page come from. Each line names the figure it backs.

  1. The slope of a line is the change in y divided by the change in x, and is undefined for a vertical line.

    SlopeWolfram MathWorld

  2. The angle of inclination of a line is measured counterclockwise from the positive x axis over the range 0 to 180 degrees.

    InclinationWolfram MathWorld

  3. The distance between two points follows from the Pythagorean theorem applied to the horizontal and vertical separations.

    Distance FormulaWolfram MathWorld

How Are Loan Payments Calculated? Amortization, Explained

One level payment, front-loaded interest — the formula worked by hand, the two levers you control, and why the smaller payment is often the costlier loan.

July 23, 2026 · 13 min read

How Does Inflation Work? The Math That Shrinks Money

One growth factor, two answers — what today's money will buy later, and how many future dollars it takes to keep up.

July 23, 2026 · 13 min read

How Is Sales Tax Calculated? Rates, Rules, and the Reverse Math

The combined-rate reality, the one-multiplication forward formula, and the division that pulls the tax back out of any total.

July 23, 2026 · 13 min read