Slope Calculator (Two Points)
Find the slope, line equation, distance and angle between two points.
Step-by-step working
- m = (y₂ − y₁) / (x₂ − x₁) = (8 − 2) / (4 − 1)
- b = y₁ − m·x₁
- d = √((Δx)² + (Δy)²)
Mathematical Formula
Overview & Explanation
Slope is rise over run. Two points fully determine a line, its length and angle.
How It Works
- Subtract coordinates.
- Divide rise by run (vertical lines have undefined slope).
- Solve for the intercept.
Practical Applications
- Graphing linear equations.
- Gradient of a road or roof.
Slope from two points
Slope m = (y2 - y1) / (x2 - x1), the rise divided by the run. For the points (2, 3) and (6, 11), the rise is 11 - 3 = 8 and the run is 6 - 2 = 4, so m = 2. The line climbs 2 units for every 1 unit to the right.
The y-intercept is b = y1 - m x x1 = 3 - 2 x 2 = -1, giving the line y = 2x - 1. The angle with the x-axis is arctan(2), about 63.43 degrees.
Special cases and grades
A horizontal line has slope 0. A vertical line has a run of 0, so its slope is undefined. Perpendicular lines have slopes that multiply to -1, so a line perpendicular to slope 2 has slope -1/2. On roads and ramps slope is often written as a percentage grade: a rise of 5 m over 100 m of horizontal distance is a 5% grade.
Example 1: (1, 2) to (4, 8)
Slope 2.
Inputs
x₁: 1 · y₁: 2 · x₂: 4 · y₂: 8
Step 1
m = (y₂ − y₁) / (x₂ − x₁) = (8 − 2) / (4 − 1)
Step 2
b = y₁ − m·x₁
Step 3
d = √((Δx)² + (Δy)²)
Slope m
Result
Example 2: (−2, 3) to (6, −1)
Negative slope.
Inputs
x₁: -2 · y₁: 3 · x₂: 6 · y₂: -1
Step 1
m = (y₂ − y₁) / (x₂ − x₁) = (-1 − 3) / (6 − -2)
Step 2
b = y₁ − m·x₁
Step 3
d = √((Δx)² + (Δy)²)
Slope m
Result
How it's calculated & sources
m = (y₂ − y₁) / (x₂ − x₁); b = y₁ − m·x₁; d = √((x₂ − x₁)² + (y₂ − y₁)²); θ = atan2(Δy, Δx).
Frequently Asked Questions
What is an undefined slope?
Slope as a percentage?
Parallel and perpendicular lines?
Does the order of the points matter?
What does a negative slope mean?
Related Calculators
Pythagorean Theorem Calculator
Find the hypotenuse or a missing leg of a right triangle using a² + b² = c².
Quadratic Equation Solver
Solve ax² + bx + c = 0 for real or complex roots, with the discriminant, vertex and full step-by-step working.
Percentage Calculator
Calculate percentages, percentage change, and percentage of a number instantly.
Percentage Increase Calculator
Calculate the percentage growth or increase from an initial value to a final value.