Slope Calculator

Slope, y-intercept and distance between two points on a line.

Slope (m)
2.0000
  1. Slope (m)2.0000
  2. y-intercept (b)0.0000
  3. Distance between points4.4721
Inputs used
  • Point 1 — x1
  • Point 1 — y2
  • Point 2 — x3
  • Point 2 — y6

About this calculator

The slope of the line through two points is rise over run: m = (y₂ − y₁) ÷ (x₂ − x₁). A slope of 2 means the line climbs 2 units for every 1 unit it moves right; negative slopes fall; zero is horizontal.

With the slope known, the y-intercept follows from either point: b = y − mx, giving the full line equation y = mx + b. The distance between the points comes from the Pythagorean theorem on the run and rise.

Two points with the same x-coordinate make a vertical line — its slope is undefined (division by zero), and the calculator reports an error rather than a made-up number.

Frequently asked questions

What is the formula for slope?

Slope is rise over run: m = (y₂ − y₁) ÷ (x₂ − x₁). For the points (1, 2) and (3, 6) that is (6 − 2) ÷ (3 − 1) = 4 ÷ 2 = 2.

What is the slope of a horizontal line?

Zero. A horizontal line has no rise, so y₂ − y₁ = 0 and the slope is 0 ÷ (x₂ − x₁) = 0 for any two of its points.

Why is the slope of a vertical line undefined?

A vertical line has two points with the same x-coordinate, so the run x₂ − x₁ is zero and the formula divides by zero. Division by zero has no value, so the slope is undefined rather than infinite.

How do I find the y-intercept from the slope?

Rearrange y = mx + b to b = y − mx using either point. For (1, 2) with slope 2, b = 2 − 2 × 1 = 0, giving the line equation y = 2x.

Embed this calculator on your site

Paste this HTML where you want the calculator to appear. It stays free, works on any site, and updates automatically. Adjust the height to taste.

Results are informational only — not financial, medical or legal advice.