Line Equation Calculator

Find line equations from points or slope.

FreeNo accountOn your device

Runs in your browser. How to verify

Loading tool…

About this tool

Enter two points to get the line through them. (1, 2) and (3, 8) have slope 3 and give y = 3x − 1.

How to use

1
Step 1
Enter the first point.
2
Step 2
Enter the second point.
3
Step 3
Press Calculate.

How it works

The slope is rise over run, m = (y₂ − y₁) ÷ (x₂ − x₁). The intercept comes from b = y₁ − m·x₁. If both points have the same x, the line is vertical and has no slope, so the result is x = constant.

m = (y₂ − y₁) ÷ (x₂ − x₁)      b = y₁ − m·x₁

Worked example

A vertical line

Input
(2, 1) and (2, 9)
Output
x = 2
Walkthrough
Both points share x = 2, so the run is 0 and the slope is undefined. Every point on the line has x = 2.

Limitations

  • Coefficients are rounded to six decimal places and zeros are dropped, so the line through (0, 0) and (3, 4) is y = 1.333333x.
  • The two points must be different; identical points return an error.

Questions

What is the line through (1, 2) and (3, 8)?
y = 3x − 1.
What is the line through (0, 0) and (3, 4)?
y = 1.333333x.
What if the line is vertical?
It has no slope and is written x = c, for example x = 2.

Features

  • Slope-intercept form
  • Detects vertical lines
  • Runs in your browser

Related resources

Guides and videos from around the web—opens on YouTube or the publisher’s site.

  • Finding mean, median, and mode

    Khan Academy

    Descriptive stats used across statistics tools.

    Watch on YouTube
  • Area of triangles intuition

    Khan Academy

    Derives ½bh so triangle and area calculators make sense.

    Watch on YouTube