Slope Calculator | Gradient & Line
Calculate the slope of a line between two points and find the line equation.
What Is the Slope Calculator | Gradient & Line?
The Slope Calculator computes the gradient, y-intercept, angle with the x-axis, distance between points, midpoint, and both parallel and perpendicular slopes from any two coordinates. Results are shown in slope-intercept form (y = mx + b), point-slope form, and in a visual SVG coordinate plane with rise/run helpers drawn automatically.
- ›Slope (gradient) m = rise/run = Δy/Δx, rate of change of y per unit x
- ›Slope-intercept: y = mx + b gives the full line equation directly
- ›Perpendicular slope: m⊥ = −1/m, negative reciprocal (product = −1)
- ›Coordinate plane visualization: rise (green) and run (yellow) shown on the line
Formula
Slope Formulas
Slope
m = (y₂−y₁) / (x₂−x₁) = Δy/Δx
Slope-intercept
y = mx + b (b = y₁ − mx₁)
Point-slope
y − y₁ = m(x − x₁)
Angle
θ = arctan(m) in degrees
Perpendicular
m⊥ = −1/m (m × m⊥ = −1)
Distance
d = √((Δx)² + (Δy)²)
How to Use
- 1Enter x₁, y₁ (first point) and x₂, y₂ (second point)
- 2Press Enter or click Calculate Slope
- 3Slope, angle, distance, and midpoint are shown in the summary tiles
- 4The line equations (slope-intercept, point-slope) are shown below
- 5The SVG coordinate plane shows the two points, the line, and rise/run labels
- 6Use preset examples for instant demonstration with common coordinate pairs
Example Calculation
Points: (2, 1) and (6, 9)
b = y₁ − mx₁ = 1 − 2×2 = −3
Slope-intercept: y = 2x − 3
Point-slope: y − 1 = 2(x − 2)
Angle: θ = arctan(2) = 63.43°
Distance: d = √((6−2)² + (9−1)²) = √(16+64) = √80 = 4√5 ≈ 8.944
Midpoint: ((2+6)/2, (1+9)/2) = (4, 5)
Perpendicular lines
If the slope of line 1 is m = 2, a perpendicular line has slope m⊥ = −1/2. Confirm: 2 × (−1/2) = −1. Any two lines satisfying m₁ × m₂ = −1 are perpendicular.
Understanding Slope | Gradient & Line
Slope Angle Reference
| Slope m | Angle θ | Description | Real-world example |
|---|---|---|---|
| 0 | 0° | Horizontal | Flat road, zero grade |
| 0.1 | 5.7° | Gentle rise | Highway on-ramp (10%) |
| 1/12 | 4.8° | ADA max ramp | Wheelchair-accessible ramp |
| 1 | 45° | Equal rise/run | 1:1 diagonal |
| 2 | 63.4° | Steep | Steep mountain path |
| ∞ | 90° | Vertical | Cliff face, undefined slope |
Frequently Asked Questions
What does slope mean in real life?
Every context where one quantity changes relative to another can be described as a slope. The steeper the slope, the faster the change.
- ›Road grade: a 5% slope = 5 m rise per 100 m horizontal (5/100 = 0.05)
- ›Roof pitch: a 4/12 pitch = 4 inches rise per 12 inches run
- ›ADA ramp standard: slope ≤ 1:12 (max 8.33%) for wheelchair accessibility
- ›Speed: slope of a distance–time graph is velocity (m/s)
What does a negative slope mean?
The sign of slope encodes direction: positive = rising, negative = falling, zero = flat, undefined = vertical.
- ›m > 0: line rises left to right (positive correlation)
- ›m < 0: line falls left to right (negative correlation)
- ›m = 0: horizontal line, constant function
- ›Undefined (Δx = 0): vertical line x = constant
What is the slope-intercept form?
The slope-intercept form is preferred because it immediately shows two key features of the line: its steepness (m) and where it starts on the y-axis (b).
- ›y = 3x + 2: slope 3, crosses y-axis at (0, 2)
- ›y = −0.5x + 10: falls (negative slope), y-intercept at 10
- ›y = x: passes through origin, slope 1 (45° angle)
- ›From two points: b = y₁ − mx₁ after computing slope
How are slope and derivative related?
Slope is the foundation of differential calculus. Understanding slope deeply makes the derivative intuitive: it is simply the slope of the tangent line, computed as the limit of rise/run as the run approaches zero.
- ›f(x) = 2x + 3: derivative f′(x) = 2 = slope (constant, linear)
- ›f(x) = x²: derivative f′(x) = 2x (slope changes with x)
- ›Tangent line at x=1 for x²: slope = 2×1 = 2, equation y = 2x − 1
- ›Negative derivative = decreasing function = negative slope at that point
What are parallel and perpendicular lines?
Parallel and perpendicular relationships are used in geometry proofs, construction, navigation, and computer graphics. The perpendicular condition m₁m₂ = −1 is derived from the rotation of 90°.
- ›Parallel: y = 3x + 1 and y = 3x − 7 (same slope, different intercept)
- ›Perpendicular: y = 2x + 5 and y = −0.5x + 1 (2 × −0.5 = −1)
- ›Special case: horizontal (m=0) and vertical (undefined) are perpendicular
- ›Finding perpendicular through a point: y − y₀ = (−1/m)(x − x₀)
How do you find the distance between two points?
The distance formula is directly derived from the Pythagorean theorem. In 3D, it extends to √((x₂−x₁)² + (y₂−y₁)² + (z₂−z₁)²).
- ›Points (1,2) and (4,6): d = √((4−1)² + (6−2)²) = √(9+16) = √25 = 5
- ›Points (0,0) and (3,4): d = √(9+16) = 5 (classic 3-4-5 right triangle)
- ›For GPS: haversine formula extends this to spherical Earth geometry
- ›Midpoint formula: ((x₁+x₂)/2, (y₁+y₂)/2), midpoint of the segment
What is point-slope form and when is it used?
Point-slope form is the most direct way to write a line equation when starting from a derivative or gradient at a specific point, common in calculus (tangent lines) and physics.
- ›Tangent to x² at (3,9): slope = 2×3 = 6, equation: y − 9 = 6(x − 3)
- ›Simplify: y = 6x − 18 + 9 = 6x − 9 (slope-intercept form)
- ›Used in Newton's method: tangent approximation at each iteration
- ›Preferred in physics for motion equations: v − v₀ = a(t − t₀)