Math

Line Equation Calculator

Find the equation of a line from two points or slope and intercept. Calculate slope, angle, and linear equation.

CALCULATOR

Enter your numbers

Instant results
y = 2x + 0Line Equation
Slope2
Y-Intercept0
Angle63.43°

THE NUMORIX GUIDE

How to use the Line Equation Calculator

Last reviewed September 14, 2026

What this calculator does

In Two Points mode, calculate slope m=(y2-y1)/(x2-x1), intercept b=y1-m*x1, angle=arctan(m), and equation y=m*x+b.

Formula and method

In Two Points mode, calculate slope m=(y2-y1)/(x2-x1), intercept b=y1-m*x1, angle=arctan(m), and equation y=m*x+b. In Slope + Intercept mode, use the supplied m and b directly.

Variables and inputs

Mode defaults to Two Points with (1,2) and (4,8). The alternate mode exposes slope m default 2 and intercept b default 3.

Worked example

For (1,2) and (4,8): dx=3, dy=6, m=2; b=2-2*1=0; equation y=2x; angle=arctan(2)=63.43 degrees.

How to interpret the result

The slope-intercept equation describes every point on a straight nonvertical line. The slope is rise per run and the intercept is its value at x=0.

Common mistakes to avoid

Use the same point order for dx and dy. A vertical line has no finite slope or y-intercept and should be written x=constant.

Assumptions and limitations

The engine returns a special x=constant result for vertical lines. It does not fit a line through more than two points or calculate uncertainty.

Practical use and checks

The Line Equation Calculator returns slope-intercept form from two points or from a supplied slope and intercept. Enter points (1, 2) and (4, 8) as a check; slope should be 2, intercept 0, angle about 63.43 degrees, and the equation y = 2x. Substituting either point confirms the line. In slope-intercept mode, entering slope -3 and intercept 5 should produce y = -3x + 5, with a negative angle because the line falls from left to right. Use the two-points mode when measurements provide endpoints and slope-intercept mode when a rate and baseline are already known. A vertical line has undefined slope and is represented as x = constant; it does not have an ordinary finite y-intercept. Coordinates should share a meaningful scale, and slope units are output-units per input-unit. The calculator fits exactly two points, so it does not average noise or provide a goodness-of-fit measure. Extrapolating far outside the observed range can be misleading even when the line is mathematically correct. Very small horizontal separation magnifies measurement error, and rounded slope output can alter a long-range prediction. Keep the original points, mode, and reference direction with the equation whenever it is used in a design or forecast.

Sources and references

COMMON QUESTIONS

Frequently asked questions

Why are two points enough?

Exactly one nonvertical straight line passes through two distinct points, which determines both slope and intercept.

How do I enter a vertical line?

Use Two Points with equal x-values; the engine reports x=that value instead of a slope-intercept equation.