Equation of a line calculator: two points, point-slope form, slope-intercept form
The equation of a line calculator finds the linear equation passing through two given points or through one point with a known slope. It outputs the result in slope-intercept form, point-slope form, and standard form, along with the slope, intercepts, distance between two points, and calculation steps.
How the equation is derived
Given two points (x1, y1) and (x2, y2), the slope m is calculated as (y2 - y1) / (x2 - x1). With the slope known and one point on the line, the equation can be written in point-slope form and then converted to slope-intercept or standard form.
If x1 equals x2 the line is vertical and has no finite slope. The equation is simply x = x1. Vertical lines cannot be expressed in slope-intercept form.
m = (y2 - y1) / (x2 - x1)
Slope from two points. This is the specific relationship the calculator applies when building the result.
y - y1 = m(x - x1)
Point-slope form when you already know one point and the slope.
y = mx + b
Slope-intercept form, where b is the y-intercept.
Forms of a linear equation
Slope-intercept form (y = mx + b) is the most common. Point-slope form (y - y1 = m(x - x1)) is useful when you know a point and the slope. Standard form (Ax + By = C) is used in systems of equations and has integer coefficients by convention.
When to use two points versus point and slope
Use the two-points workflow when the problem gives you two coordinates on the same line. The calculator first finds the slope from the rise-over-run relationship, then uses one point to solve for the y-intercept and rearrange into the requested forms.
Use the point-and-slope workflow when you already know the rate of change. This is common in algebra word problems where the slope is a constant rate, such as dollars per item or metres per second, and one measured point anchors the line.
Worked example: line through two points
Suppose the two points are (1, 2) and (4, 8). The slope is (8 - 2) / (4 - 1), which simplifies to 2. Substituting point (1, 2) into y = mx + b gives 2 = 2(1) + b, so b = 0.
That means the slope-intercept form is y = 2x. The same line can be written in point-slope form as y - 2 = 2(x - 1), and in standard form as 2x - y = 0.
LibreTexts — Forms of lines — Open educational reference covering slope-intercept, point-slope, standard, vertical, and horizontal line forms.
Frequently asked questions
What if both points are the same?
If both points are identical, infinitely many lines pass through that single point. The calculator needs two distinct points to determine a unique line.
How do I convert between forms?
From point-slope form, distribute and solve for y to get slope-intercept form. From slope-intercept form, rearrange terms so that x and y are on one side and the constant is on the other to get standard form.
How can I check the equation of a line through two points result manually?
The safest manual check is to follow the same formula or rule one step at a time and compare that working with the calculator output. That catches sign errors, bracket mistakes, and input-order mixups without requiring any extra method beyond the underlying maths itself.
Can I find a line equation from one point and a slope?
Yes. Use point-slope form y - y1 = m(x - x1). The calculator's point-and-slope mode uses the entered point and slope, solves for the y-intercept, and then reports slope-intercept and standard form.
Why does a vertical line not have slope-intercept form?
A vertical line has equation x = constant, so it does not pass the vertical-line test for y as a function of x. Its slope is undefined, and it cannot be written as y = mx + b with a finite m value.
What is standard form for a line?
Standard form is usually written as Ax + By = C, often with integer coefficients and A nonnegative. It is useful for systems of equations because both variables are kept on the same side.