Slope Calculator
Calculate the slope, angle, and y-intercept of the line through two points.
Rise over run between the two points.
- 1
Run (horizontal change)
x₂ − x₁ = 4 − 1 = 3 - 2
Rise (vertical change)
y₂ − y₁ = 8 − 2 = 6 - 3
Slope m = rise ÷ run
6 ÷ 3 = 2
Formula
How this is calculated
You enter two points on a line: the first point (x₁, y₁) and the second point (x₂, y₂). Each value is a plain coordinate on the Cartesian plane, with no units assumed — they can be any real numbers.
The calculator first finds the run, dx = x₂ − x₁ (the horizontal change), and the rise, dy = y₂ − y₁ (the vertical change). The slope m is rise divided by run, m = dy ÷ dx, so a larger ratio means a steeper line. The angle of inclination comes from the arctangent of the slope, converted from radians to degrees: angle = arctan(m) × 180 ÷ π, giving a value between −90° and 90°. The y-intercept b is where the line crosses the y-axis, found by back-substituting one point: b = y₁ − m·x₁. Together these produce the slope-intercept equation y = mx + b.
The key edge case is a vertical line: when x₁ = x₂ the run is zero, so the slope is undefined (division by zero) and the angle is reported as 90°. A zero rise gives a horizontal line with slope 0.
Examples
| Input | Result |
|---|---|
| (1, 2) and (4, 8) | m = 2, angle ≈ 63.43°, b = 0 |
About this calculator
The slope (or gradient) of a line measures how steeply it rises or falls. Given two points (x₁, y₁) and (x₂, y₂), the slope is the change in y divided by the change in x: m = (y₂ − y₁) ÷ (x₂ − x₁), often called "rise over run." A positive slope rises left to right, a negative slope falls, and a slope of zero is a horizontal line.
From the slope you can find the angle of inclination using the arctangent, and the y-intercept b with b = y₁ − m·x₁, which lets you write the full slope-intercept equation y = mx + b. When the two points have the same x-coordinate the line is vertical and the slope is undefined.
Frequently asked questions
Rise over run is the vertical change (rise) divided by the horizontal change (run) between two points. It is exactly the slope of the line.
A vertical line has no horizontal change, so the run is zero. Dividing the rise by zero is undefined, which is why vertical lines have no numeric slope.
Once you have the slope m, compute the y-intercept b = y₁ − m·x₁. The line is then y = mx + b in slope-intercept form.
Also known as
TG we-Calculate Editorial Team. (2026). Slope Calculator [Online calculator]. TG we-Calculate. https://we-calculate.com/calculator/slope-calculator
TG we-Calculate Editorial Team. "Slope Calculator." TG we-Calculate. 2026. https://we-calculate.com/calculator/slope-calculator.
TG we-Calculate Editorial Team, "Slope Calculator," TG we-Calculate, 2026. [Online]. Available: https://we-calculate.com/calculator/slope-calculator
@misc{wecalculate_slope_calculator, title = {Slope Calculator}, author = {{TG we-Calculate Editorial Team}}, howpublished = {\url{https://we-calculate.com/calculator/slope-calculator}}, year = {2026}, note = {TG we-Calculate} }
Did this calculator help you?
