Quick answer
The slope of a line through two points is the rise divided by the run: m = (y₂ − y₁) ÷ (x₂ − x₁). The calculator also returns the line equation, the distance between the points and the angle of inclination.
Slope tells you how steeply a line rises or falls. The same number appears in road grade, roof pitch and the rate of change of a graph.
Related tools: Slope-Intercept Form Calculator: Line equation y = mx + b from a slope and a point. Point-Slope Form Calculator: Point-slope and slope-intercept equations of a line. Standard Form to Slope-Intercept Form Calculator: Convert Ax + By = C to y = mx + b.
How to use the Slope Calculator
- Enter x₁.
- Enter y₁.
- Enter x₂.
- Enter y₂.
- Press Calculate to see the result, and use Reset to start again.
| Input | What to enter | Allowed values |
|---|---|---|
| x₁ | A number | — |
| y₁ | A number | — |
| x₂ | A number | — |
| y₂ | A number | — |
Formula and method
Formula
m = (y₂ − y₁) ÷ (x₂ − x₁); b = y₁ − m·x₁
IEEE-754 double precision; shown to at most 6 decimal places.
Rise over run; a vertical line has undefined slope.
Worked examples
These examples are verified: each one is an automated test case that the live calculator must reproduce exactly.
Example 1
Inputs: x₁ = 1; y₁ = 2; x₂ = 3; y₂ = 6.
| Result | Value |
|---|---|
| Slope | 2 |
| Line equation | y = 2x + 0 |
| Distance | 4.472136 |
| Angle of inclination | 63.434949° |
Example 2
Inputs: x₁ = 0; y₁ = 0; x₂ = 4; y₂ = -2.
| Result | Value |
|---|---|
| Slope | -0.5 |
| Line equation | y = -0.5x + 0 |
| Distance | 4.472136 |
| Angle of inclination | -26.565051° |
Example 3
Inputs: x₁ = 0; y₁ = 3; x₂ = 5; y₂ = 3.
| Result | Value |
|---|---|
| Slope | 0 |
| Line equation | y = 0x + 3 |
| Distance | 5 |
| Angle of inclination | 0° |
The first line is the headline result (slope). Below it the slope Calculator lists line equation, distance and angle of inclination, which describe the same case from other angles. IEEE-754 double precision; shown to at most 6 decimal places.
Reading the sign and size of the slope
A positive slope rises from left to right and a negative slope falls. A slope of 0 is a horizontal line, and a vertical line (x₁ = x₂) has no defined slope because the run is zero. A slope of 1 means a 45° line: for every unit across, one unit up.
For the points (3, 2) and (7, 5) the rise is 3 and the run is 4, so the slope is 3/4 = 0.75. The intercept is b = y₁ − m·x₁ = 2 − 0.75 × 3 = −0.25, so the line is y = 0.75x − 0.25.
Common mistakes
- Subtracting the coordinates in different orders on top and bottom; use the same point order for both.
- Putting the run over the rise (that gives the reciprocal).
- Expecting a number for a vertical line.
Slope as the second point moves (first point at (1, 2), second at x = 3)
Every figure in this table comes from running this calculator, so it matches what the form returns.
| y₂ | Slope | Line equation | Angle of inclination |
|---|---|---|---|
| -2 | -2 | y = -2x + 4 | -63.434949° |
| 2 | 0 | y = 0x + 2 | 0° |
| 6 | 2 | y = 2x + 0 | 63.434949° |
| 10 | 4 | y = 4x − 2 | 75.963757° |
What happens with invalid input
These messages are produced by the calculator itself, so you know what to fix.
- x₂: entering "1" shows "The two points must be different." beside that field and no result.
Choosing between the Slope Calculator and similar calculators
Each row shows what a related calculator on this site asks for and what it returns, so you can pick the one that matches your question.
| Calculator | You enter | It returns |
|---|---|---|
| [Slope-Intercept Form Calculator](/math/slope-intercept-form/) | slope, point x and point y | Equation |
| [Point-Slope Form Calculator](/math/point-slope-form/) | slope, point x₁ and point y₁ | Point-slope form |
| [Standard Form to Slope-Intercept Form Calculator](/math/standard-form-to-slope-intercept-form/) | a, b and c | Slope-intercept form |
| [LCM Calculator](/math/lcm-calculator/) | numbers | Least common multiple |
| [Factor Calculator](/math/factor-calculator/) | number | Factors |
Background: algebra
Many algebra calculators rest on the same ideas: write the problem in a standard form, identify the coefficients, apply the formula and check the answer by substituting it back. For a quadratic ax² + bx + c = 0 the roots are (−b ± √(b² − 4ac)) ÷ 2a, and the discriminant b² − 4ac decides the kind of roots: positive gives two real roots, zero gives one repeated root and negative gives two complex conjugate roots.
If a = 0 the equation is linear, not quadratic. A sign slip on the −b term shifts both roots by the same amount, so substitute your roots back to check.
Assumptions and limitations
- Identical points define no line
- x₁ = x₂ gives an undefined (vertical) slope
If a required value is empty, not a number, or outside its allowed range, the form marks that field with a message and shows no result instead of a misleading number. The automated checks deliberately try invalid entries for x₂ to confirm this.
Frequently asked questions
What is the slope of a vertical line?
It is undefined, because the run (x₂ − x₁) is zero and division by zero is not allowed. The calculator tells you so instead of showing a number.
What does the Slope Calculator calculate?
Slope, angle, distance and line equation through two points. It returns Slope, Line equation, Distance and Angle of inclination.
What formula does the Slope Calculator use?
m = (y₂ − y₁) ÷ (x₂ − x₁); b = y₁ − m·x₁. Rise over run; a vertical line has undefined slope.
What do I need to enter in the slope Calculator?
You enter x₁, y₁, x₂ and y₂.
How is the result rounded or limited?
IEEE-754 double precision; shown to at most 6 decimal places. Identical points define no line.
What are the limits of this calculator?
Identical points define no line. x₁ = x₂ gives an undefined (vertical) slope.
What is an example of a slope result?
With x₁ 1, y₁ 2, x₂ 3 and y₂ 6, the slope is 2.
Related calculators
- Slope-Intercept Form Calculator — Line equation y = mx + b from a slope and a point.
- Point-Slope Form Calculator — Point-slope and slope-intercept equations of a line.
- Standard Form to Slope-Intercept Form Calculator — Convert Ax + By = C to y = mx + b.
- LCM Calculator — Least common multiple of two or more numbers.
- Factor Calculator — List every factor of a positive whole number.
- Quadratic Formula Calculator — Solve ax² + bx + c = 0, including complex roots.
Sources
- OpenStax, Algebra and Trigonometry 2e (Rice University): exponents, radicals, logarithms and inverse trigonometric functions
Content last reviewed 2026-11-04. Formulas and worked examples are checked by automated tests against independently computed values.