Line Equation Calculator
Find the equation of a straight line using two points, a slope and y-intercept, a slope and one point, or a point and y-intercept. Calculate the slope, intercepts, and different equation forms, and view the line on a coordinate graph.
Calculate the Equation of a Line
Choose the information you know about the line and enter the corresponding values.
Line Equation Formulas
1. Slope-Intercept Form
The slope-intercept form is one of the most common ways to express the equation of a straight line.
Here, m represents the slope, while b represents the y-intercept.
2. Slope Formula from Two Points
When two distinct points are known, calculate the slope using:
After finding the slope, substitute one of the points into y = mx + b to calculate the y-intercept.
3. Point-Slope Form
When the slope and one point are known, use:
4. Standard Form
The standard form of a line is:
A, B, and C are constants. Standard form is useful for comparing equations and solving systems of linear equations.
5. Vertical and Horizontal Lines
Horizontal line: y = b
A vertical line has an undefined slope, while a horizontal line has a slope of zero.
Worked Examples
Example 1: Equation from Two Points
Find the equation of the line passing through A(1, 2) and B(3, 6).
b = 2 - (2 × 1) = 0
y = 2x
Example 2: Slope and Y-Intercept
Find the equation when the slope is 3 and the y-intercept is 4.
y = 3x + 4
Example 3: Slope and One Point
Find the equation of a line with slope 2 passing through (3, 7).
y - 7 = 2x - 6
y = 2x + 1
Example 4: Vertical Line
Find the equation of the line passing through (4, 2) and (4, 8).
The x-coordinate is constant.
Equation: x = 4
Frequently Asked Questions
1. What is the equation of a straight line?
A straight line is commonly expressed as y = mx + b, where m is the slope and b is the y-intercept.
2. How do you find the equation of a line from two points?
First calculate the slope using the difference in y-coordinates divided by the difference in x-coordinates. Then use either point to calculate the y-intercept and write the equation in slope-intercept form.
3. What does the slope tell you?
The slope describes how steep a line is and whether it rises or falls as x increases. A positive slope rises, a negative slope falls, and a zero slope is horizontal.
4. What is the y-intercept?
The y-intercept is the point where a line crosses the y-axis. Its x-coordinate is always zero.
5. What is the equation of a vertical line?
A vertical line has an equation x = a, where a is a constant. Its slope is undefined because the change in x is zero.
6. Can a line have a slope of zero?
Yes. A horizontal line has a slope of zero and can be written as y = b.
7. What is the standard form of a line?
Standard form is Ax + By = C, where A, B, and C are constants.
8. Can two points define a vertical line?
Yes. If two distinct points have the same x-coordinate, they define a vertical line.
Related Calculators
Explore more geometry and coordinate calculators: