Code tool

Line Equation from Two Points Calculator

Enter two distinct points to calculate slope and a line equation.

In-browser processingNo account requiredPrivacy details ↗

Line equation from two points

Cartesian coordinates; distinct points required.

Equation: —

A QUICK WALKTHROUGH

How to use this tool

  1. Enter x and y coordinates for point one.
  2. Enter x and y coordinates for point two.
  3. Review slope and equation; vertical lines are shown as x = constant.

Formula and scope

For distinct points, slope m = (y₂−y₁)/(x₂−x₁). If x₁ = x₂, the line is vertical and is written x = x₁. Otherwise y-intercept b = y₁−mx₁ and equation is y = mx+b.

Coordinate geometry

Coordinates must use the same Cartesian coordinate system. Local calculation only.

GOOD TO KNOW

Common questions

What if the x coordinates match?

The line is vertical; slope is undefined and the equation is x = that shared coordinate.