Skip to content
CalculatorAtlas

Slope Calculator

Tested

Slope, angle, distance and line equation through two points.

Tested, not yet published. The formula for this calculator is implemented and passes its automated checks. This page stays non-indexable until it is reviewed and published.

Results

Enter your values and press Calculate. Results appear here.

  • • Result

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

  1. Enter x₁.
  2. Enter y₁.
  3. Enter x₂.
  4. Enter y₂.
  5. Press Calculate to see the result, and use Reset to start again.
Inputs of the Slope Calculator
InputWhat to enterAllowed 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.

Results of example 1
ResultValue
Slope2
Line equationy = 2x + 0
Distance4.472136
Angle of inclination63.434949°

Example 2

Inputs: x₁ = 0; y₁ = 0; x₂ = 4; y₂ = -2.

Results of example 2
ResultValue
Slope-0.5
Line equationy = -0.5x + 0
Distance4.472136
Angle of inclination-26.565051°

Example 3

Inputs: x₁ = 0; y₁ = 3; x₂ = 5; y₂ = 3.

Results of example 3
ResultValue
Slope0
Line equationy = 0x + 3
Distance5
Angle of inclination0°

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.

Slope as the second point moves (first point at (1, 2), second at x = 3)
y₂SlopeLine equationAngle of inclination
-2-2y = -2x + 4-63.434949°
20y = 0x + 20°
62y = 2x + 063.434949°
104y = 4x − 275.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.

Choosing between the Slope Calculator and similar calculators
CalculatorYou enterIt returns
[Slope-Intercept Form Calculator](/math/slope-intercept-form/)slope, point x and point yEquation
[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 cSlope-intercept form
[LCM Calculator](/math/lcm-calculator/)numbersLeast common multiple
[Factor Calculator](/math/factor-calculator/)numberFactors

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.

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.