How to find the slope from two points
- Label the points (x₁, y₁) and (x₂, y₂).
- Find the rise: subtract the y-values, y₂ − y₁.
- Find the run: subtract the x-values in the same order, x₂ − x₁.
- Divide rise by run to get the slope m, and simplify the fraction. If the run is 0, the slope is undefined.
- For the equation, find b = y₁ − m·x₁ and write y = mx + b.
What is the slope of a line?
The slope of a line measures how steep it is: how much y changes for every 1 unit that x increases. It is usually written as m. A slope of 2 means the line goes up 2 units for every 1 unit to the right, and a slope of −1/2 means it goes down 1 unit for every 2 units to the right. Slope is often described as "rise over run".
m = rise ÷ run = (y₂ − y₁) ÷ (x₂ − x₁) How do you 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. Here is a full example for the points (−3, 5) and (3, 1):
- Rise: 1 − 5 = −4.
- Run: 3 − (−3) = 6.
- Slope: m = −4 ÷ 6 = −2/3. Always simplify the fraction.
- Y-intercept: b = y₁ − m·x₁ = 5 − (−2/3)(−3) = 5 − 2 = 3.
- Equation: y = (−2/3)x + 3.
The negative slope tells you the line falls from left to right. The distance between the two points is 7.211 units and the angle of inclination is about 146.31°.
The four types of slope
- Positive slope (m > 0): the line rises from left to right, like y = 2x.
- Negative slope (m < 0): the line falls from left to right, like y = −x + 4.
- Zero slope (m = 0): a horizontal line, y = c. The rise is 0.
- Undefined slope: a vertical line, x = c. The run is 0, and division by zero is undefined.
Equations of a line
Once you know the slope you can write the line's equation. Both forms below describe the same line.
- Slope-intercept form:
y = mx + b, where b is the y-intercept (where the line crosses the y-axis). Find b withb = y₁ − m·x₁. - Point-slope form:
y − y₁ = m(x − x₁). Plug in the slope and either point. It is quick to write and easy to rearrange into y = mx + b.
If b is a fraction, keep it as a fraction for an exact answer. The calculator shows b as a simplified fraction, such as y = (4/3)x + 2/3.
Angle, distance and midpoint
The same two points give you three more useful values:
angle θ = tan⁻¹(m) (add 180° if m < 0) distance d = √((x₂ − x₁)² + (y₂ − y₁)²) midpoint = ((x₁ + x₂) ÷ 2, (y₁ + y₂) ÷ 2) The distance formula is the Pythagorean theorem in disguise: the run and rise are the legs of a right triangle and the distance is the hypotenuse. Try it with the Pythagorean theorem calculator.
Slope examples
| Points | Slope m | Equation | Angle |
|---|---|---|---|
| (0, 0) and (2, 4) | 2 | y = 2x | 63.43° |
| (1, 1) and (3, 7) | 3 | y = 3x − 2 | 71.57° |
| (2, 3) and (6, 5) | 1/2 (0.5) | y = (1/2)x + 2 | 26.57° |
| (−1, 4) and (2, −2) | −2 | y = −2x + 2 | 116.57° |
| (0, 3) and (4, 0) | −3/4 (−0.75) | y = (−3/4)x + 3 | 143.13° |
| (−2, −1) and (4, 3) | 2/3 (0.666667) | y = (2/3)x + 1/3 | 33.69° |
| (1, 5) and (6, 5) | 0 | y = 5 | 0° |
| (3, −2) and (3, 6) | undefined | x = 3 | 90° |
| (1.5, 2) and (3.5, 5) | 3/2 (1.5) | y = (3/2)x − 1/4 | 56.31° |
Common mistakes
- Mixing the order. If you do y₂ − y₁ on top, you must do x₂ − x₁ on the bottom. Mixing them flips the sign of the slope.
- Putting x on top. Slope is change in y over change in x, not the other way round.
- Dropping negative signs. Subtracting a negative adds: 3 − (−3) = 6. Brackets help.
- Calling a vertical line's slope 0. Horizontal lines have slope 0. Vertical lines have an undefined slope.
- Not simplifying. −4/6 should be written as −2/3. The fraction calculator can simplify fractions for you.
Frequently asked questions
How do you find the slope from two points?
Subtract the y-values and divide by the difference of the x-values in the same order: m = (y₂ − y₁) ÷ (x₂ − x₁). For (1, 2) and (4, 6), the slope is (6 − 2) ÷ (4 − 1) = 4/3.
What does a slope of 0 mean?
A slope of 0 means the line is horizontal. The y-value never changes, so the equation is y = c, for example y = 5 for the points (2, 5) and (−1, 5).
What is an undefined slope?
A slope is undefined when the line is vertical, because the run (x₂ − x₁) is 0 and you cannot divide by zero. The equation of a vertical line is x = c, for example x = 3 for the points (3, −1) and (3, 4).
Does it matter which point is first?
No. Swapping the points flips the sign of both the rise and the run, so the slope comes out the same. The only rule is to subtract in the same order on the top and the bottom.
How do you find the y-intercept from the slope and a point?
Use b = y₁ − m·x₁. With slope 4/3 and the point (1, 2): b = 2 − 4/3 × 1 = 2/3, so the line is y = (4/3)x + 2/3.
What is the angle of inclination of a line?
The angle of inclination is the angle the line makes with the positive x-axis, measured counterclockwise, from 0° up to (not including) 180°. It equals tan⁻¹(m) for a positive slope and tan⁻¹(m) + 180° for a negative slope. A slope of 1 gives 45°.
How is slope related to the Pythagorean theorem?
The rise and run are the two legs of a right triangle, and the distance between the points is its hypotenuse: d = √(run² + rise²). The Pythagorean theorem calculator shows that step in detail.
Last reviewed November 27, 2026 by the ChalkStation team.