How to Find the Slope and Equation of a Line From Two Points

Learn rise over run, calculate slope from two points, write the line in slope-intercept, point-slope and standard form, and convert slope to angle and grade.

Updated September 29, 2026 6 min read

Use the free Slope CalculatorSlope, intercepts and line equation from two points, with a graph

Slope is the number that says how steep a line is and which way it goes. In algebra it connects two points to an equation. In everyday life it is the gradient of a road, the pitch of an access ramp, or the rate at which one quantity changes as another grows, such as cost per unit or distance per hour.

This guide explains what slope means, how to calculate it from two points, how to turn it into the three standard forms of a line's equation, and how to convert slope into an angle or a percentage grade. The examples were all checked with our calculator.

Slope is rise over run

For two points (x₁, y₁) and (x₂, y₂), the slope m is the change in y divided by the change in x:

m = (y₂ − y₁) ÷ (x₂ − x₁) = rise ÷ run = Δy ÷ Δx

Example: (1, 2) and (4, 11)

Δy = 11 − 2 = 9
Δx = 4 − 1 = 3
m = 9 ÷ 3 = 3

For every 1 unit you move right, the line goes up 3.

The order of the points does not matter as long as you are consistent: (2 − 11) ÷ (1 − 4) = −9 ÷ −3 = 3 as well.

Reading the sign

Slope Line Example
Positive Rises left to right m = 3
Negative Falls left to right (−2, 5) to (3, −5): m = −10 ÷ 5 = −2
Zero Horizontal (0, 4) to (6, 4): m = 0
Undefined Vertical (3, 1) to (3, 7): Δx = 0

A vertical line has no slope because you would be dividing by zero. Its equation is simply x = 3. That is different from a horizontal line, whose slope is 0 and whose equation is y = 4.

Three forms of a line's equation

Once you know the slope and one point, you can write the line's equation in whichever form you need.

Slope-intercept form: y = mx + b

b is the y-intercept, where the line crosses the y-axis. Find it by substituting a known point:

b = y₁ − m × x₁ = 2 − 3 × 1 = −1
y = 3x − 1

This form is best for graphing and for reading off the rate of change.

Point-slope form: y − y₁ = m(x − x₁)

Write it straight from one point and the slope, with no extra calculation:

y − 2 = 3(x − 1)

Expanding it gives y = 3x − 1 again.

Standard form: Ax + By = C

Move the terms so that x and y are on one side with whole-number coefficients:

3x − y = 1

Standard form handles vertical lines (x = 3 is already in it) and is used when solving simultaneous equations.

A fractional example: (2, 3) and (8, 7). m = 4 ÷ 6 = 2/3, b = 3 − (2/3)(2) = 5/3, so y = (2/3)x + 5/3. Multiplying by 3 gives the standard form 2x − 3y = −5. Keeping fractions exact avoids errors like writing b ≈ 1.67 and drifting away from the true line.

Parallel and perpendicular lines

  • Parallel lines have equal slopes. Any line parallel to y = 3x − 1 has slope 3.
  • Perpendicular lines have slopes that multiply to −1. A line perpendicular to slope 3 has slope −1/3; one perpendicular to 2/3 has slope −3/2.

Slope as an angle and a percentage grade

Road signs and building codes rarely say "slope 0.0833". They use angles or percentages.

angle  = tan⁻¹(m)
grade  = m × 100%

Example: an access ramp that rises 1 unit for every 12 units of run has m = 1/12 ≈ 0.0833. That is an 8.33% grade and an angle of about 4.76°. Ratios like 1:12 are common in accessibility guidance; check the current rules for your country before building.

For the line through (1, 2) and (4, 11), m = 3 means a 300% grade and an angle of about 71.57°. A 100% grade is 45°, not vertical.

How to use the Slope Calculator

  1. Open the Slope Calculator.
  2. Enter the two points in x₁, y₁, x₂ and y₂. Integers, decimals and fractions such as 1/2 are accepted, and results stay exact.
  3. Read the slope m at the top, with a decimal version if it is a fraction.
  4. The rows give the Slope-intercept form, Point-slope form and Standard form, each with a copy button, plus the y-intercept, x-intercept, Angle of inclination, Grade (rise ÷ run × 100) and Direction.
  5. You also get the Distance between the points (as an exact surd where needed) and the Midpoint.
  6. A graph plots both points and the line. Open the steps for the rise, run, slope, intercept and angle calculations.

If the two x-values are equal, the tool reports an undefined slope, a vertical line and its equation x = constant.

Other ways to find slope

  • By hand on graph paper: pick two points where the line crosses grid intersections, count squares up and across, and divide.
  • Spreadsheets: =SLOPE(B2:B3, A2:A3) returns the slope through two points (y-values first), and =INTERCEPT(B2:B3, A2:A3) gives b. With more than two points these return the best-fit line instead.
  • Graphing calculators: plot the points and use a linear regression function.

The distance part of the output is the Pythagorean theorem in disguise; the Pythagorean Theorem Calculator explains it with a diagram. For curves rather than straight lines, the Quadratic Equation Solver graphs parabolas, and the Midpoint Calculator handles 3D points.

Common mistakes

Subtracting in different orders

(y₂ − y₁) on top and (x₁ − x₂) below flips the sign. Always use the same point first in both.

Putting x on top

Slope is change in y over change in x. Run over rise gives the reciprocal.

Treating undefined and zero as the same

A horizontal line has slope 0. A vertical line has an undefined slope. They are opposites.

Losing negative signs

Subtracting a negative adds: 3 − (−2) = 5. Bracket negative coordinates when substituting.

Frequently asked questions

How do you find the slope between two points?

Subtract the y-values and divide by the difference of the x-values in the same order. For (1, 2) and (4, 11), the slope is (11 − 2) ÷ (4 − 1) = 3.

What is the slope of a vertical line?

It is undefined, because the run is zero and division by zero is not possible. The equation is x = a constant.

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

Find the slope, substitute one point into y = mx + b to find b, then write the equation. For (1, 2) and (4, 11), that gives y = 3x − 1.

How do I convert slope to degrees?

Take the inverse tangent of the slope. A slope of 1/12 is tan⁻¹(0.0833) ≈ 4.76°, and a slope of 1 is 45°.

What is the difference between slope and grade?

They are the same ratio in different units. Grade is slope written as a percentage, so a slope of 0.08 is an 8% grade.

Try it now: Slope Calculator

Loading tool…