Skip to content
Saha Hesap

Line Equation Calculator

Equation of a line from two points or from a point and a slope: y = mx + n, general form ax + by + c = 0, slope angle and axis intercepts.

What is the equation of a line?

A line in the plane is fixed by two pieces of information: two points on it, or one point and its slope. The most common way to write it is y = mx + n, where m is the slope and n is where the line crosses the y axis.

Line through two points

Find the slope first: m = (y₂ − y₁) / (x₂ − x₁). Then substitute one of the points: n = y₁ − m × x₁.

Example: for the line through (1, 2) and (3, 6), m = (6 − 2) / (3 − 1) = 2 and n = 2 − 2 × 1 = 0. The equation is y = 2x.

Line from a point and a slope

Write y − y₀ = m × (x − x₀) and rearrange. For the line through (2, 3) with slope 0.5, n = 3 − 0.5 × 2 = 2 and the equation is y = 0.5x + 2.

General form

The same line can be written as ax + by + c = 0. This form also covers vertical lines, where b is zero and the equation becomes x = constant. From the general form the slope is −a / b, the y intercept is −c / b and the x intercept is −c / a.

Slope angle and intercepts

The slope angle is the angle between the line and the +x axis and follows from tan θ = m. A slope of 1 gives 45 degrees, and a negative slope gives an angle above 90 degrees. The line meets the y axis where x = 0 and the x axis where y = 0.

Where is it used?

Finding the level at an intermediate point of a ramp, pipe or slab from the levels at its two ends, interpolating linearly between two measurements, or finding where the extension of an edge lands on a drawing all use the equation of a line.

Limits

The calculator handles lines in the plane. Two identical points do not define a line. A vertical line has no defined slope.

Related calculators

Found a mistake or something missing?

If a value looks wrong, a size is missing or you need a feature, write to us and we will fix it.

Send an email