Skip to content
CalcHub

Slope Calculator

Find the slope between two points along with the line's equation, intercepts, angle, length, midpoint, and perpendicular slope.

Slope CalculatorLive

How to use this calculator

  1. 1Enter the x and y coordinates of your first point.
  2. 2Enter the coordinates of the second point.
  3. 3Read the slope and the equation. The perpendicular slope is there for finding a line at right angles to this one.

How it works

Slope and line formulas

m = (y₂ − y₁) ÷ (x₂ − x₁)
Slope-intercept:  y = mx + b
Point-slope:      y − y₁ = m(x − x₁)
Distance:         d = √((x₂−x₁)² + (y₂−y₁)²)
Midpoint:         ((x₁+x₂)/2, (y₁+y₂)/2)
Perpendicular slope = −1 ÷ m

Slope measures steepness as the ratio of vertical change to horizontal change. Once you have it, everything else follows: substituting either point into y = mx + b gives the intercept, the distance formula is Pythagoras applied to the rise and run, and the perpendicular slope is the negative reciprocal because the product of two perpendicular slopes is always −1.

Worked example

Between (2, 3) and (8, 15): the rise is 15 − 3 = 12 and the run is 8 − 2 = 6, so the slope is 2. Substituting the first point into y = 2x + b gives 3 = 4 + b, so b = −1 and the line is y = 2x − 1.

Slope Calculator: the complete guide

Rise over run, and getting the order right

Slope is rise over run: the change in y divided by the change in x. The one rule that matters is consistency — subtract the coordinates in the same order in both the numerator and the denominator. Using y₂ − y₁ over x₁ − x₂ flips the sign and gives a line pointing the wrong way.

The result is a rate of change. A slope of 2 means y increases by 2 for every 1 that x increases. In an applied context that is a speed, a price per unit, or a cost per hour — which is why slope is the bridge between geometry and every linear model in science and economics.

Zero, undefined, and why they differ

A horizontal line has a slope of exactly zero: no rise, so the ratio is 0 ÷ run. A vertical line has an undefined slope: no run, so the ratio would be rise ÷ 0, which does not exist.

The distinction matters because a vertical line cannot be written as y = mx + b at all. Its equation is x = c, and it fails the function test — one x value maps to infinitely many y values. This calculator flags the vertical case rather than returning a very large number.

Parallel and perpendicular lines

Parallel lines have identical slopes — that is the definition, since equal steepness means they never converge. Perpendicular lines have slopes whose product is −1, so each is the negative reciprocal of the other: a line of slope 2 is crossed at right angles by a line of slope −½.

The exception is the horizontal-vertical pair. A slope of 0 has no reciprocal, so the perpendicular to a horizontal line is a vertical line with an undefined slope, and the −1 rule does not literally apply.

Slope as grade and angle in the real world

Road engineers express slope as a percentage grade, which is simply the slope times 100. A 6% grade rises 6 feet over 100 feet of horizontal distance — steep enough for runaway-truck ramps. Roof pitch uses rise per 12 inches of run instead, so a 6/12 pitch is a slope of 0.5.

Accessibility standards are among the strictest applications: a wheelchair ramp is generally limited to a 1:12 slope, which is 8.33% or about 4.76°. Note how different those three numbers look for the same physical steepness — the grade percentage and the angle only agree at very shallow slopes.

Frequently asked questions

How do I find the slope from two points?

Subtract the y-coordinates to get the rise, subtract the x-coordinates in the same order to get the run, then divide. For (2,3) and (8,15): (15−3) ÷ (8−2) = 12 ÷ 6 = 2.

What does a negative slope mean?

The line falls from left to right — y decreases as x increases. In an applied context it represents a declining rate: depreciation over time, or demand falling as price rises.

How do I find the equation of a line from two points?

Calculate the slope first, then substitute either point into y = mx + b and solve for b. Both points give the same b, which is a useful check on your arithmetic. All three standard forms are shown above.

What is the difference between slope and grade?

Grade is slope expressed as a percentage — multiply the slope by 100. A slope of 0.06 is a 6% grade. The angle in degrees is a third form, found with arctan of the slope, and it only matches the grade percentage closely at shallow slopes.