How to Calculate Line Equation
What is Line Equation?
The equation of a line in slope-intercept form is y = mx + c, where m is the slope (gradient) and c is the y-intercept. It describes every straight line in 2D space.
Formula
Slope-intercept: y = mx + b; Point-slope: y − y₀ = m(x − x₀); General: Ax + By + C = 0
- m
- slope (rise/run)
- b
- y-intercept
- (x₀, y₀)
- a point on the line
- A, B, C
- coefficients in general form
Step-by-Step Guide
- 1Slope m = (y₂−y₁)/(x₂−x₁)
- 2y-intercept c = y − mx
- 3Parallel lines have equal slopes
- 4Perpendicular lines: m₁×m₂ = −1
Worked Examples
Input
Points (0,2) and (3,8)
Result
m = (8−2)/(3−0) = 2, c = 2, so y = 2x + 2
Input
m = 3, passes through (1, 5)
Result
y − 5 = 3(x − 1), so y = 3x + 2
Frequently Asked Questions
How do I find the slope between two points?
m = (y₂ − y₁) / (x₂ − x₁).
What is a vertical line equation?
x = c (constant). Vertical lines have undefined slope and cannot be written in y = mx + b form.
How do I convert between slope-intercept and general form?
From y = mx + b to Ax + By + C = 0: rearrange to −mx + y − b = 0 or mx − y + b = 0.
Ready to calculate? Try the free Line Equation Calculator
Try it yourself →