Math calculator

Free slope calculator

Find the slope between two points and the equation of the line — enter (x₁, y₁) and (x₂, y₂) to see slope, y-intercept, and line equation, updated live, as you type.

InputsLive
X₁
Y₁
X₂
Y₂
Enter two points (x₁ ≠ x₂) to calculate slope.
Result
Slope (m)
0.5
y = 0.5x + 1
Y-Intercept (b)1
Rise2
Run4

m = (y₂−y₁)/(x₂−x₁). Vertical line (x₁=x₂) is undefined.

Results are estimates. Consult a professional.

How it's calculated

How the slope calculator works

Slope measures the steepness and direction of a straight line. Given any two points on the line, slope is the ratio of the vertical change (rise) to the horizontal change (run). Once the slope is known, the full line equation can be written in slope-intercept form or point-slope form.

Slope: m = (y₂ y₁) / (x₂ x₁) = rise / run
Slope-intercept form: y = mx + b
Point-slope form: y y₁ = m(x x₁)
y-intercept: b = y₁ m·x₁
Weisstein, E. W. Slope. MathWorld.
Example

Worked example: points (1, 2) and (4, 8)

Example: find the slope and equation through (1, 2) and (4, 8)

Given two points (1, 2) and (4, 8), calculate the slope, then write the line equation using the slope-intercept form.

m = (8 2) / (4 1) = 6 / 3 = 2
b = y₁ m·x₁ = 2 2(1) = 0
Equation: y = 2x + 0 → y = 2x
m = 2
The line rises 2 units for every 1 unit moved right, described by y = 2x.
Quick reference

Slope types and their interpretations

The sign and magnitude of slope convey direction and steepness at a glance.

Slope (m)DirectionReal-world analogy
m > 0Rises left to right (positive)Walking uphill
m < 0Falls left to right (negative)Walking downhill
m = 0Horizontal (flat)Walking on level ground
m undefinedVertical (infinite steepness)A cliff face — x₁ = x₂
|m| > 1Steeper than 45°Steep ramp
|m| < 1Shallower than 45°Gentle incline

Undefined slope occurs when the two x-coordinates are identical (vertical line).

Practical tips

Tips for working with slope

These tips cover the errors most commonly made when computing or interpreting slope.

  • Keep the order consistent — always subtract the coordinates in the same order: (y₂−y₁)/(x₂−x₁). Reversing both numerator and denominator gives the same result; reversing only one flips the sign.
  • Check for vertical lines early — if x₁ = x₂ the slope is undefined (division by zero); the line is vertical and cannot be written in slope-intercept form.
  • Convert to slope-intercept for graphing — y = mx+b makes it easy to plot: start at (0, b) and move right 1 unit and up m units for each subsequent point.
  • Parallel lines share the same slope — two lines are parallel if m₁ = m₂ and perpendicular if m₁ × m₂ = −1.
  • Use slope in real contexts — a road with slope 0.06 rises 6 cm per 100 cm of horizontal distance, which is a 6% grade.
Accuracy & limits

Accuracy and limitations

Slope calculations are exact for integer or simple fractional inputs. For decimal coordinates, results carry standard floating-point precision (≈15 significant digits). The slope formula applies only to straight lines; curved functions have a slope that varies at every point and requires calculus (the derivative) to compute. When both points are identical, neither slope nor a unique line is defined.

Glossary

Key terms

The ratio of rise to run between any two points on a straight line: m = (y₂−y₁)/(x₂−x₁).
The vertical change between two points: y₂ − y₁.
The horizontal change between two points: x₂ − x₁.
The y-coordinate where a line crosses the y-axis (x=0).
The line equation y = mx + b, where m is slope and b is the y-intercept.
An alternative line equation y − y₁ = m(x − x₁), useful when a point and slope are known.
About

About this calculator

Part of our math calculators suite — explore all calculators.

Questions

Frequently asked questions about the free slope calculator

A slope calculator is a free online tool that helps you find the slope of a line through two points (rise over run) plus the y-intercept. Slope is the steepness of a line. It's the change in y for each unit change in x — 'rise over run'. Combined with one point, it defines a unique line: y = mx + b. It runs entirely in your browser with instant results and no sign-up.
Vertical lines have undefined slope — they're 'infinitely steep'. Algebraically, the run (x₂ − x₁) is zero, which makes the rise/run ratio undefined (division by zero). The calculator returns no result for vertical lines.
Positive slope means the line rises from left to right (y increases as x increases). Negative slope means it falls. Zero slope is a horizontal line. Vertical lines have undefined slope.
Compute slope first, then use either point to find the y-intercept by plugging into y = mx + b. The calculator does both in one step.

Want a calculator built for your business?

Customize any of our 400+ tools to match your brand, or commission a new one tailored to how your business actually calculates — pricing, payroll, quotes, anything. Deployed on your domain, math runs in your visitors' browsers.