Equation of a Line from Two Points
This calculator helps you determine the equation of a straight line in the slope-intercept form (y = mx + b) when you are given any two distinct points that lie on the line. It automatically computes the slope (m) and the y-intercept (b) for you.
Enter the x-coordinate of the first point.
Enter the y-coordinate of the first point.
Enter the x-coordinate of the second point.
Enter the y-coordinate of the second point.
This calculator helps you determine the equation of a straight line in the slope-intercept form (y = mx + b) when you are given any two distinct points that lie on the line. It automatically computes the slope (m) and the y-intercept (b) for you.
Slope (m) = (y₂ - y₁) / (x₂ - x₁) Y-intercept (b) = y₁ - m * x₁ Equation: y = mx + b
Given two points (x₁, y₁) = (2, 3) and (x₂, y₂) = (5, 9): 1. Calculate the slope (m): m = (9 - 3) / (5 - 2) = 6 / 3 = 2. 2. Calculate the y-intercept (b) using (2, 3): b = 3 - 2 * 2 = 3 - 4 = -1. 3. The equation of the line is y = 2x - 1.
The equation of a line is a mathematical expression that describes all the points lying on that line. The most common form is the slope-intercept form, y = mx + b, where 'm' is the slope and 'b' is the y-intercept.
The slope (m) is calculated as the change in y divided by the change in x between two points (x₁, y₁) and (x₂, y₂). The formula is m = (y₂ - y₁) / (x₂ - x₁).
The y-intercept (b) is the point where the line crosses the y-axis. It is the value of y when x is 0. Once you have the slope, you can find 'b' using one of the points: b = y₁ - m * x₁.
Yes, this calculator can handle both vertical and horizontal lines. For vertical lines (where x₁ = x₂), the slope is undefined, and the equation will be in the form x = C. For horizontal lines (where y₁ = y₂), the slope is 0, and the equation will be in the form y = C.
© 2026 PromathTools. All rights reserved.
Built by KruskalCode – SaaS & Automation Experts