Slope Intercept Calculator: Find the Line Equation
- Slope
- Result
- Y-intercept
- Result
- First point x-coordinate
- 1
- You entered
An all-in-one slope-intercept calculator finds a line’s slope and y-intercept from two points, or evaluates the line at a chosen x-value. Enter coordinates in consistent units to get the equation in the form y = mx + b, along with useful checks on the result.
Formula
The slope-intercept form of a straight line is y = mx + b. The calculator obtains slope from two points, then uses either point to find the intercept:
- m = (y₂ − y₁) / (x₂ − x₁), where m is the slope and (x₁, y₁), (x₂, y₂) are the supplied points.
- b = y₁ − mx₁, where b is the y-intercept.
- y = mx + b, where x is the entered input value and y is the corresponding output.
Coordinates are numerical values; their units depend on the situation. For example, if x is measured in seconds and y in metres, slope is metres per second and b is in metres. The x and y coordinates do not have to use the same unit, but each axis must be internally consistent.
Worked Example
Using the calculator’s defaults, the two points are (1, 3) and (3, 7), and the requested x-value is 4.
- Find the change in y: 7 − 3 = 4. Find the change in x: 3 − 1 = 2.
- Calculate the slope: m = 4 / 2 = 2.
- Find the intercept using (1, 3): b = 3 − (2 × 1) = 1.
- Write the equation: y = 2x + 1.
- Evaluate at x = 4: y = (2 × 4) + 1 = 9.
The outputs are y = 9, slope m = 2, and intercept b = 1. Substituting either original point checks the equation: at x = 1 it gives y = 3, and at x = 3 it gives y = 7.
What Slope and Intercept Mean
Slope measures the line’s change in y for each one-unit change in x. A positive slope rises from left to right; a negative slope falls. A slope of zero is horizontal. The y-intercept is the value of y where the line crosses the vertical axis, which occurs at x = 0.
In the example, a slope of 2 means y increases by 2 units for every 1-unit increase in x. The intercept of 1 means the line passes through (0, 1). The equation also lets you find other points: x = 5 gives y = 11.
Slope is not always unitless. If both axes use the same units, the units cancel; if they use different quantities, express slope as a ratio such as dollars per item, kilometres per hour, or degrees Celsius per year. The intercept carries the same unit as y.
When to Use This Calculator
Use a slope-intercept calculator when you know two points on a straight line and want its equation, or when you already have a line and need to calculate an output for a particular input. It is useful for checking algebra, interpreting a graph, and modelling a constant rate of change.
For example, a linear model of a tank’s water level might use elapsed time as x and water depth as y. The slope describes the rate of change in depth, while the intercept estimates the depth at time zero. That interpretation is meaningful only if a straight-line model is appropriate over the period being considered.
If you have a graph, identify two points that lie on the line and read their coordinates as accurately as possible. If you have an equation in another form, rearrange it to isolate y before identifying m and b. For example, 2x + y = 5 becomes y = −2x + 5.
Vertical Lines and Other Limits
The formula for slope divides by x₂ − x₁. If the two points have the same x-coordinate, that denominator is zero, so the slope is undefined. The points describe a vertical line, such as x = 4, which cannot be written as y = mx + b. A calculator should flag this case rather than return a finite slope.
If the two points are identical, they do not determine one unique line: infinitely many lines pass through that single point. You need another distinct point or other information about the line. With two distinct points whose x-coordinates differ, exactly one straight line is determined.
The method assumes a straight line and exact input coordinates. Real measurements may be noisy, and rounding coordinates can noticeably affect the slope, especially when the points are close together. For a trend estimated from many data points, a line of best fit is generally more appropriate than calculating a line through just two observations.
Common Mistakes and Checks
- Reversing only part of the slope calculation: Keep the order consistent: y₂ − y₁ over x₂ − x₁. Reversing both differences gives the same slope; reversing just one changes its sign.
- Confusing the intercept with a supplied point: b is the y-value at x = 0, not necessarily y₁ or y₂.
- Mixing coordinate units: Convert values to a common unit on each axis before calculating. For example, do not combine x-values in metres with x-values in centimetres without conversion.
- Rounding too early: Keep full precision in intermediate steps and round the final slope, intercept, or evaluated y-value only as needed.
- Assuming every relationship is linear: A line through two points always exists when their x-values differ, but it may not describe the behaviour between or beyond those observations.
A quick check is to substitute both input points into y = mx + b. If both satisfy the equation, the calculated line passes through them. Also check the sign and units of the slope against the context.
Frequently Asked Questions
How do I find slope from two points?
Subtract the first y-coordinate from the second, then divide by the second x-coordinate minus the first: m = (y₂ − y₁) / (x₂ − x₁). Keep the point order consistent in numerator and denominator.
How do I find the y-intercept?
After finding m, substitute either known point into b = y − mx. The result is the line’s y-value when x equals zero.
Can a vertical line be written in slope-intercept form?
No. A vertical line has a constant x-coordinate and an undefined slope, so it is written as x = c rather than y = mx + b.
What if I have the slope and one point?
Use b = y − mx to calculate the intercept, then write y = mx + b. For instance, slope 3 through (2, 8) gives b = 8 − 3(2) = 2, so the equation is y = 3x + 2.
Is slope-intercept form the same as point-slope form?
No. Point-slope form is y − y₁ = m(x − x₁); slope-intercept form is y = mx + b. They describe the same line when rearranged, but each presents different information directly.
Related
Formula used
in x1 | First point x-coordinate | - | 1 in y1 | First point y-coordinate | - | 3 in x2 | Second point x-coordinate | - | 3 in y2 | Second point y-coordinate | - | 7 in x | x-value to evaluate | - | 4 out y | y-value at entered x | - | ((y2 - y1) / (x2 - x1)) * x + (y1 - ((y2 - y1) / (x2 - x1)) * x1) | 2 out m | Slope | - | (y2 - y1) / (x2 - x1) | 2 out b | Y-intercept | - | y1 - ((y2 - y1) / (x2 - x1)) * x1 | 2
Each line is one input (in, sel, list) or one result (out: label, unit, formula, decimals). How the calculators work
Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.