Slope Calculator
Calculate the slope, equation, distance, midpoint, and angle between two points on a coordinate plane. Includes an SVG diagram and step-by-step calculation. See also Quadratic Formula Calculator and Percentage Calculator.
How to Calculate Slope
Slope measures the steepness and direction of a line. Given two points (x₁, y₁) and (x₂, y₂), the slope is the ratio of the vertical change (rise) to the horizontal change (run). A positive slope means the line goes up from left to right, a negative slope means it goes down, zero slope is horizontal, and undefined slope is vertical. Once you have the slope, you can find the y-intercept and write the equation of the line in slope-intercept form (y = mx + b).
Slope Formulas
Slope: m = (y₂ − y₁) / (x₂ − x₁)
y-intercept: b = y₁ − m × x₁
Equation: y = mx + b
Distance between two points:
d = √((x₂ − x₁)² + (y₂ − y₁)²)
Midpoint:
M = ((x₁ + x₂)/2, (y₁ + y₂)/2)
Angle with x-axis:
θ = arctan(m) = arctan((y₂ − y₁) / (x₂ − x₁))
Example Calculation
Point 1: (2, 3) | Point 2: (8, 9)
Slope = (9 − 3) / (8 − 2) = 6 / 6 = 1
y-intercept = 3 − 1 × 2 = 1
Equation: y = x + 1
Distance = √(6² + 6²) = √72 = 8.4853
Midpoint = (5, 6)
Angle = arctan(1) = 45°
Slope Reference Table
| Point 1 | Point 2 | Slope | Equation | Distance |
|---|---|---|---|---|
| (0, 0) | (1, 1) | 1 | y = x | 1.414 |
| (0, 0) | (1, 2) | 2 | y = 2x | 2.236 |
| (1, 2) | (3, 8) | 3 | y = 3x − 1 | 6.325 |
| (2, 3) | (8, 9) | 1 | y = x + 1 | 8.485 |
| (0, 5) | (5, 0) | −1 | y = −x + 5 | 7.071 |
| (−2, 1) | (4, 1) | 0 | y = 1 | 6.000 |
| (3, 0) | (3, 5) | Undef. | x = 3 | 5.000 |
Frequently Asked Questions
What does slope represent?
Slope represents the rate of change — how much y changes for each unit change in x. A slope of 2 means y increases by 2 for every 1 unit increase in x. In real-world terms, slope can represent speed (distance/time), rate of growth, or steepness of a hill.
What is an undefined slope?
A vertical line has an undefined slope because the run (Δx) is zero, and division by zero is undefined. Vertical lines are written as x = constant rather than in y = mx + b form.
How do I find the slope from an equation?
In slope-intercept form (y = mx + b), the slope is the coefficient m. In standard form (Ax + By = C), the slope is −A/B. In point-slope form (y − y₁ = m(x − x₁)), the slope is m directly.
What are parallel and perpendicular slopes?
Parallel lines have equal slopes (m₁ = m₂). Perpendicular lines have slopes that are negative reciprocals (m₁ × m₂ = −1). For example, if one line has slope 2, a perpendicular line has slope −1/2.
Does the order of points matter?
No. The slope is the same regardless of which point you call (x₁, y₁) and which you call (x₂, y₂). Both (y₂−y₁)/(x₂−x₁) and (y₁−y₂)/(x₁−x₂) give the same result because both numerator and denominator change sign.