All Tools490+

Slope Calculator – Instantly Find y = mx + b From 2 Points (Easy)

Slope of a Line Calculator

Free slope calculator – find the slope, y-intercept, and the exact equation (y = mx + b) of a line between two points.

Point A (x₁, y₁)

Point B (x₂, y₂)

Line Geometry Report
Equation of the Line
y = mx + b
Slope (m) / Gradient 0
Y-Intercept (b) 0
Distance Between Points 0
Angle (from X-Axis) 0°
Results copied! ✓

Use this free slope calculator to get the slope and the full y = mx + b equation from any two points.

Quick answer

Slope m = (y₂ − y₁) ÷ (x₂ − x₁) and the y-intercept b = y₁ − m·x₁. Example: points (−2, 3) and (4, 0) give m = (0 − 3) ÷ (4 − (−2)) = −0.5, b = 3 − (−0.5)(−2) = 2, so the line is y = −0.5x + 2. This slope calculator also shows the distance between the points (6.7082) and the angle of the line.

Slope tells you how steep a line is and in which direction it goes. It appears everywhere: algebra homework, physics graphs, road gradients, roof pitch, and rates of change in business data.

Our free slope calculator takes two points and returns the slope, the y-intercept, the equation in slope-intercept form, the distance between the points and the angle from the x-axis. It also handles vertical lines (undefined slope) and horizontal lines (slope 0).

Slope Formulas

ValueFormula
Slope (m)(y₂ − y₁) ÷ (x₂ − x₁)
y-intercept (b)y₁ − m·x₁
Equationy = mx + b
Distance√[(x₂ − x₁)² + (y₂ − y₁)²]
Angletan⁻¹(m), in degrees

Types of Slope

SlopeLine looks likeExample points
PositiveRises left to right(1, 2) and (4, 8) → m = 2, y = 2x
NegativeFalls left to right(−2, 3) and (4, 0) → m = −0.5
ZeroHorizontal(2, 5) and (6, 5) → y = 5
UndefinedVertical(3, 1) and (3, 7) → x = 3

How to Use the Slope Calculator

Get the line equation in two steps.

Step 1: Enter Two Points

Type the coordinates of Point A (x₁, y₁) and Point B (x₂, y₂) – for example (−2, 3) and (4, 0) – and click Calculate Line.

Step 1 enter two points in the slope calculator y = mx + b

Step 2: Read the Line Geometry Report

The report shows the equation of the line, the slope (gradient), the y-intercept, the distance between the points and the angle from the x-axis. Click Copy Results to paste them into your work.

Step 2 slope calculator result y = -0.5x + 2 with slope, intercept, distance and angle

Slope in Real Life

  • Roads and ramps: a 1:12 wheelchair ramp has a slope of about 0.083 (8.3%).
  • Roofs: a 6/12 pitch roof rises 6 units for every 12 across – slope 0.5.
  • Business: slope of a sales trend line = growth per month.
  • Physics: slope of a distance–time graph is speed.

Common Slope Mistakes

  • Mixing the order: always subtract in the same order for y and x.
  • Dividing by zero: if x₁ = x₂ the line is vertical and the slope is undefined.
  • Forgetting negative signs when a coordinate is negative.

Need lines through a point instead? Try the Parallel & Perpendicular Line Finder, or find the middle of a segment with the Midpoint Calculator.

How to Find Slope by Hand (Then Check With the Slope Calculator)

  1. Label the points: (x₁, y₁) = (1, 2) and (x₂, y₂) = (4, 8).
  2. Rise: y₂ − y₁ = 8 − 2 = 6.
  3. Run: x₂ − x₁ = 4 − 1 = 3.
  4. Slope: 6 ÷ 3 = 2.
  5. Intercept: b = 2 − 2·1 = 0, so y = 2x.

Typing the same points into the slope calculator gives y = 2x, a distance of 6.7082 and an angle of 63.43°, confirming the hand calculation.

Frequently Asked Questions

How do you calculate slope from two points?

Subtract the y-values and divide by the difference in x-values: m = (y₂ − y₁) ÷ (x₂ − x₁).

What is b in y = mx + b?

b is the y-intercept – where the line crosses the y-axis. It equals y₁ − m·x₁.

What is the slope of a horizontal line?

Zero. The equation is simply y = constant, for example y = 5.

What is the slope of a vertical line?

It is undefined, because x₂ − x₁ = 0. The equation is x = constant.

Can the slope calculator handle negative and decimal numbers?

Yes. Enter any real numbers for the coordinates.

Is the slope calculator free?

Yes. It is free, runs in your browser and needs no sign-up.

MH

Written and tested by Muhammad Hasnain

Founder of VectraTools. Behaviour described here was checked against the tool’s own output. Last reviewed: October 2026.