━ Line Equation From Two Points

Find the slope and y-intercept of the line through two non-vertical points.

5.0 out of 5 (1 rating)

Enter details

Line through two points
A,B,
  • X₁ (first point)
  • Y₁ (first point)
  • X₂ (second point)
  • Y₂ (second point)

Log in or create a free account to save your inputs and results, so you don't have to enter them again next time.🔒 No spam, ever. We never sell or share your details, and you can delete your history or account at any time. Privacy policy

Fill in the details and click Calculate to see your results.

Formula at a glance

Line From 2 Points formula: y = mx + b
How the line from 2 points works: y = mx + b

Rate this calculator

Was it useful? A quick star rating helps others — and you can leave a comment too.
Rate it: ★ ★ ★ ★ ★

📘 About the Line From 2 Points Calculator

Slope-intercept form y = mx + b shows a line's slope m and where it crosses the y-axis b. Given any two points on the line you can find both.

Enter the two points to get the equation in slope-intercept form along with the point-slope and standard forms, the intercepts and the working.

🧮 Formula

Line form
y = mx + b

Where

  • m = slope
  • b = y-intercept
m = (y2-y1)/(x2-x1), b = y1-mx1.

✏️ Worked examples

(2, 1) and (6, 9)

You enter
X₁ (first point)2
Y₁ (first point)1
X₂ (second point)6
Y₂ (second point)9
You get
Slope-intercept formy = 2x − 3
Slope m2
y-intercept b-3
x-intercept1.5
Point-slope formy − 1 = 2(x − 2)
Standard form2x − y = 3
Distance between the points8.94427191
Midpoint(4, 5)
Angle with the x-axis63.4349°

y = 2x − 3.

(0, 4) and (5, 1)

You enter
X₁ (first point)0
Y₁ (first point)4
X₂ (second point)5
Y₂ (second point)1
You get
Slope-intercept formy = −0.6x + 4
Slope m-3/5 = -0.6
y-intercept b4
x-intercept6.666666667
Point-slope formy − 4 = -0.6(x − 0)
Standard form3x + 5y = 20
Distance between the points5.830951895
Midpoint(2.5, 2.5)
Angle with the x-axis-30.9638°

y = −0.6x + 4.

🧭 How to use this calculator

What you enter

  • X₁ (first point)
  • Y₁ (first point)
  • X₂ (second point)
  • Y₂ (second point)

What you get

  • Slope m
  • Y-Intercept b

💡 Common uses

  • Coordinate geometry homework and revision
  • Analytic geometry calculations
  • Checking graph and line calculations

❓ Frequently asked questions

How do you find the equation of a line from two points?

Find the slope m = (y₂ − y₁) ÷ (x₂ − x₁), then the intercept b = y₁ − m·x₁, and write y = mx + b.

What is point-slope form?

y − y₁ = m(x − x₁). It uses the slope and one point directly.

What if x₁ = x₂?

The line is vertical: its equation is x = x₁ and the slope is undefined.

What people are saying
★★★★★
Anonymous · 17 Nov 2026