Skip to content
K Knidox Search…
Math · Algebra

Slope Calculator

Find the slope, y-intercept, and line equation from two points.

Slope (m)
2

rise ÷ run = 6 ÷ 3 · y-intercept b = 0 · y = 2x

The line through both points
Straight line y = 2x through the two points100x = 0x = 5

The slope between two points is the rise divided by the run: m = (y₂ − y₁) ÷ (x₂ − x₁). For the points (1, 2) and (4, 8), the rise is 6 and the run is 3, so the slope is 2. The line through them is y = 2x.

What slope measures

Slope is how steeply a line rises or falls — the change in y for every one-unit change in x. Pick any two points on the line, divide the vertical change (the rise) by the horizontal change (the run), and you have the slope. A slope of 2 means the line climbs 2 units up for each 1 unit you move right; a slope of −½ means it drops half a unit for each step right.

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

rise over run; the run (x₂ − x₁) must be non-zero, or the line is vertical and the slope is undefined

Worked example

Find the slope and equation of the line through (1, 2) and (4, 8):

  1. 1
    Label the points. Let (x₁, y₁) = (1, 2) and (x₂, y₂) = (4, 8).
  2. 2
    Find the rise and run. Rise = y₂ − y₁ = 8 − 2 = 6. Run = x₂ − x₁ = 4 − 1 = 3.
  3. 3
    Divide to get the slope. m = rise ÷ run = 6 ÷ 3 = 2.
  4. 4
    Solve for the y-intercept. b = y₁ − m·x₁ = 2 − (2)(1) = 0.
  5. 5
    Write the equation. y = mx + b = 2x + 0, so y = 2x.

What the sign of the slope tells you

The slope’s sign and size describe the line’s direction and steepness.

Slope (m)Direction of the lineExample
Positive (m > 0)Rises from left to rightm = 2 → y = 2x
Negative (m < 0)Falls from left to rightm = −½ → y = −½x + 3
Zero (m = 0)Horizontal liney = 4
UndefinedVertical line (run = 0)x = 5

Parallel, perpendicular, and other line forms

Parallel lines have equal slopes. Two lines never meet exactly when they share the same slope but different intercepts — for example y = 2x + 1 and y = 2x − 4.

Perpendicular lines have negative-reciprocal slopes. If one line has slope m, a line at a right angle to it has slope −1 ÷ m. A line with slope 2 is perpendicular to a line with slope −½, because 2 × (−½) = −1.

Point-slope form writes a line straight from one point and the slope: y − y₁ = m(x − x₁). Rearranging it gives the slope-intercept form y = mx + b that this tool reports.

Why is the slope of a vertical line undefined?
A vertical line has two points with the same x-value, so the run (x₂ − x₁) is 0. Dividing the rise by zero is undefined, which is why a vertical line has no slope — it is written as x = a constant instead.
What does a negative slope mean?
A negative slope means the line falls as you move left to right: y decreases while x increases. For example, a slope of −½ drops the line half a unit for every one unit you move to the right.
What is the slope of a horizontal line?
It is 0. A horizontal line has no rise (y₂ − y₁ = 0), so the slope is 0 ÷ run = 0. Its equation is y = a constant, such as y = 4.
How do parallel and perpendicular slopes relate?
Parallel lines have equal slopes. Perpendicular lines have slopes that are negative reciprocals — their product is −1, so a slope of 2 is perpendicular to a slope of −½.
What is the difference between point-slope and slope-intercept form?
Point-slope form, y − y₁ = m(x − x₁), is built from the slope and a single point. Slope-intercept form, y = mx + b, isolates y and shows the y-intercept directly. They describe the same line; one rearranges into the other.
Does it matter which point I call point 1?
No. As long as you subtract the x-values and y-values in the same order, you get the same slope. Swapping both points flips the sign of the rise and the run, and the two sign changes cancel.