Equation From Two Points
Enter any two points to calculate the line equation instantly.
Supports integers and decimals. Example: (2, 5) and (6, 13).
What this equation from points calculator does
This calculator finds the equation of a straight line passing through two points on a coordinate plane. If you provide points (x₁, y₁) and (x₂, y₂), it computes the slope, identifies special cases (like vertical lines), and returns the equation in useful forms.
It is helpful for algebra, precalculus, physics, economics trend lines, and quick homework checks. Instead of manually simplifying signs and arithmetic every time, you can calculate in one click and still see the underlying math.
How to find an equation from two points
1) Compute the slope
The slope tells you how much y changes for each 1-unit change in x:
m = (y₂ - y₁) / (x₂ - x₁)
- If x₂ - x₁ = 0, the line is vertical and slope is undefined.
- If y₂ - y₁ = 0, the line is horizontal and slope is 0.
2) Use slope-intercept form
For non-vertical lines, plug slope into:
y = mx + b
Then solve for b using either point:
b = y₁ - m·x₁
3) Handle vertical line cases
If both x-values are the same (for example x₁ = x₂ = 4), the equation is:
x = 4
In that situation, the line does not have a slope-intercept equation of the form y = mx + b.
Example calculations
Example A: regular line
Points: (2, 5) and (6, 13)
- m = (13 - 5) / (6 - 2) = 8/4 = 2
- b = 5 - 2·2 = 1
- Equation: y = 2x + 1
Example B: horizontal line
Points: (-3, 7) and (9, 7)
- m = (7 - 7) / (9 - (-3)) = 0
- Equation: y = 7
Example C: vertical line
Points: (4, -2) and (4, 10)
- x-values are equal, so slope is undefined
- Equation: x = 4
Why students use this tool
- Fast way to check homework and reduce sign errors.
- Useful for graphing lines in coordinate geometry.
- Helps convert between point-slope and slope-intercept understanding.
- Covers edge cases like vertical and horizontal lines automatically.
Common mistakes to avoid
- Swapping x and y values in the slope formula.
- Forgetting parentheses with negative numbers.
- Trying to force a vertical line into y = mx + b form.
- Rounding too early during intermediate steps.
Quick FAQ
Can I use decimal points?
Yes. This calculator accepts integers and decimals in all four fields.
What if both points are identical?
If the two points are exactly the same, there are infinitely many possible lines through that single point, so one unique equation cannot be determined.
Does it show more than one equation form?
Yes. It shows slope-intercept form when possible, plus point-slope and standard form information for clarity.