Linear Function Equation Calculator
Two points determine exactly one straight line, and that is all this calculator needs. Enter any two points and it returns the slope, both intercepts, and the equation in slope-intercept, point-slope, and standard form, with each step shown and the line plotted on a graph.
Your line plotted with both points marked.
Click “Find the Equation” first to draw your line.
Quick Answer
Through the points (1, 1) and (2, 3), the slope is m = 2 and the y-intercept is b = -1, giving y = 2x – 1. In standard form that is 2x – y = 1, in point-slope form it is y – 1 = 2(x – 1), and the line crosses the x-axis at 0.5.
Key takeaways
- Slope first, always. m = (y2 – y1) / (x2 – x1) is the rise over run, and everything else follows from it.
- One line, three forms. Slope-intercept, point-slope, and standard form describe the identical line. Pick the form your problem asks for.
- Vertical is not an error. When x2 equals x1 there is no slope and no y-intercept. The equation is simply x = a constant.
- Identical points are not a line. Enter the same point twice and no single line is determined, so the calculator says so instead of guessing.
- Quick Answer
- Finding the equation in three steps
- The four forms of a line, and when to use each
- A second example: a falling line
- Reading slope and intercepts off the graph
- Vertical, horizontal, and identical points
- What other line-equation calculators get wrong
- Frequently Asked Questions
- Add This Calculator to Your Website
- References
Finding the equation in three steps
The method never changes, whatever the points are. Slope, then intercept, then the equation itself.
Compute m = (y2 – y1) / (x2 – x1). For (1, 1) and (2, 3): (3 – 1) / (2 – 1) = 2.
Find b = y1 – m times x1. Here: 1 – 2 times 1 = -1.
Write y = mx + b, which gives y = 2x – 1. Then rearrange for the other forms.
Two habits make this reliable. First, keep the point order consistent: whichever point you call point 1 in the slope numerator must also be point 1 in the denominator, or the sign flips. Second, check the answer against the second point before trusting it. Put x = 2 into y = 2x – 1 and you get y = 3, which matches point 2 exactly. A ten-second check like that catches most sign errors.
The four forms of a line, and when to use each
Every form below describes the same line through (1, 1) and (2, 3). They are not four different answers, just four costumes for one answer.
| Form | Example | Best for |
|---|---|---|
| Slope-intercept: y = mx + b | y = 2x – 1 | Graphing, and reading slope and intercept at a glance |
| Point-slope: y – y1 = m(x – x1) | y – 1 = 2(x – 1) | When you know a point and the slope but not the intercept |
| Standard: Ax + By = C | 2x – y = 1 | Systems of equations, and integer coefficients |
| Two-point: (y – y1) / (y2 – y1) = (x – x1) / (x2 – x1) | (y – 1) / 2 = (x – 1) / 1 | Derivations, since the other forms come from it |
The calculator outputs the first three forms plus the slope and both intercepts, and a parametric form for the same line (x and y each written in terms of a parameter t). A Decimals/Fractions switch above the Find the Equation button shows the slope, intercepts, and equation coefficients as fractions (for example, 1/3) instead of decimals; standard form always uses whole numbers, so it never changes. The two-point form is shown here because it is where the derivation starts, not because the tool prints it: start from it, clear the denominators, and you land on point-slope form, then slope-intercept form, then standard form.
Standard form has one house rule worth knowing. The calculator reduces it to integer coefficients with no common factor, and makes the x coefficient positive where possible, so 2x – y = 1 rather than -2x + y = -1. That matches the convention most textbooks grade against. Note also that the slope is displayed to four decimal places, while the standard form is built from the exact coordinate differences, so a slope like 1/3 shows as 0.3333 but the standard form stays exact.
A second example: a falling line
Take the points (-1, 4) and (2, -2). The slope is m = (-2 – 4) / (2 – (-1)) = -6 / 3 = -2, so the line falls as x grows. The intercept is b = 4 – (-2) times (-1) = 4 – 2 = 2, giving y = -2x + 2. In point-slope form, using the first point, that is y – 4 = -2(x + 1). In standard form it is 2x + y = 2. The x-intercept is x = -b / m = -2 / -2 = 1, so the line crosses the x-axis at (1, 0).
Check it against both points. At x = -1: y = -2 times -1 + 2 = 4, which matches the first point. At x = 2: y = -2 times 2 + 2 = -2, which matches the second. If either check failed, the slope sign would be the first suspect, since a flipped sign is the most common slip in this whole topic.
Reading slope and intercepts off the graph
The Graph tab plots the line with both input points marked in red, so the numbers stop being abstract. For y = 2x – 1, the line climbs two units for every one unit it moves right, crosses the y-axis one unit below the origin, and crosses the x-axis halfway between 0 and 1.
The slope sign tells the story at a glance. Positive slopes climb left to right, negative slopes fall, zero is flat, and undefined means vertical. If you only need the slope itself, our slope calculator isolates just that first step, and the midpoint calculator finds the point halfway between your two inputs. For curves instead of lines, try the quadratic equation calculator, or fit a trend through many points with the linear regression calculator.
Vertical, horizontal, and identical points
Edge cases are where line tools usually break, so they deserve their own section. A vertical line has x2 equal to x1, so the slope formula divides by zero. That is not an error in your inputs, it is the definition of vertical: every point on the line shares one x value. Enter (3, 1) and (3, 5) and the calculator returns x = 3, with slope undefined, no y-intercept, and an x-intercept of 3. Calling that slope “infinite” is a common textbook shorthand, but it is misleading, since no number equals it, so this tool says undefined and stops there.
A horizontal line has y2 equal to y1, so the slope is zero and the equation is y = y1. Enter (1, 2) and (4, 2) and you get y = 2 in both slope-intercept and standard form, with no x-intercept, since a flat line at height 2 never touches the x-axis. The one exception is the x-axis itself, y = 0, where every x value is an intercept, and the calculator reports the x-intercept as “every x” rather than pretending one number answers it.
Identical points are the third case, and the one most tools get wrong by treating them as vertical. Enter (2, 3) twice and there is no division to do and no line to find: infinitely many lines pass through a single point, so no single equation exists. The calculator reports “No unique line” and asks for two different points. That is not a failure mode, it is the correct mathematical answer, and naming it beats silently returning x = 2 for a line that was never determined.
What other line-equation calculators get wrong
Most two-point tools return only the slope-intercept form and stop, leaving students stuck when homework asks for standard form. A few round intermediate steps, so the printed intercept fails the check against the second point. Others mishandle vertical lines with a division-by-zero error or a nonsense “infinite slope” label, and almost none of them notice identical points at all.
This calculator was built to close those specific gaps. It returns slope-intercept, point-slope, and standard form together, shows each step with the actual numbers, plots both points on the graph, reduces the standard form to integers, names the vertical case correctly, and names the identical-points case instead of faking an answer. Its one honest limitation is the input itself: it takes exactly two points, not a point plus a slope or an equation to convert. If your problem starts from a slope and a point, point-slope form on this page still shows the route, since y – y1 = m(x – x1) is exactly that starting point, but you will need to supply a second point on the line to use the tool.
Frequently Asked Questions
Compute the slope m = (y2 – y1) / (x2 – x1), then the intercept b = y1 – m times x1, then write y = mx + b. For (1, 1) and (2, 3): m = 2, b = -1, so y = 2x – 1.
y = mx + b, where m is the slope and b is the y-intercept, the point where the line crosses the y-axis. It is the most readable form for graphing, since the slope and intercept are visible in the equation itself.
Rearrange y = mx + b into Ax + By = C with integer coefficients: multiply through to clear fractions, move the x and y terms to the left, and divide out any common factor. y = 2x – 1 becomes 2x – y = 1.
The line is vertical, with equation x = x1. The slope is undefined because the slope formula divides by zero, and there is no y-intercept, since a vertical line other than the y-axis never crosses the y-axis. Its x-intercept is x1 itself.
Set y = 0 and solve: x = -b / m. For y = 2x – 1, x = 1 / 2 = 0.5. A horizontal line has no x-intercept unless it is the x-axis itself, where every x value is an intercept.
y – y1 = m(x – x1) is the fastest form when you know one point and the slope. Expand it and simplify to reach slope-intercept form.
No single line is determined, so the calculator reports no unique line. Infinitely many lines pass through one point, so change one coordinate to make the two points differ, then calculate again.
Add This Calculator to Your Website
References
- Omni Calculator. Slope Intercept Form Calculator (derivation of slope and intercept formulas). Accessed October 25, 2026.
- Omni Calculator. Line Equation from Two Points Calculator (slope-intercept and standard forms, vertical-line case). Accessed October 25, 2026.
- True Geometry. Calculating Linear Equations via Two-Point Geometries. Accessed October 25, 2026.
- Calculator Ultra. Two Point Form Calculator and Formula. Accessed October 25, 2026.
