Slope y Intercept Calculator: Find Line Equation
The calculator for this page is switched off while it is checked. The formula is below, and the worked example in the article shows how to use it by hand.
This slope y intercept calculator takes two points or a slope and one point, then works out the slope (m) and the y-intercept (b) of a straight line in the form y = mx + b. You enter the coordinates of two points on the line, and you get back the slope, the y-intercept, and the full equation of the line. It also shows the steps so you can check the math yourself.
Formula
The slope-intercept form of a line is:
y = mx + b
Where:
- m = slope (the steepness of the line, unitless)
- b = y-intercept (the y-coordinate where the line crosses the y-axis, in the same units as y)
- x and y = coordinates of any point on the line (same units as your input)
Given two points (x�, y�) and (x₂, y₂), the slope is:
m = (y₂ − y�) / (x₂ − x�)
Then the y-intercept is found by plugging one point into the equation:
b = y� − m·x�
If you already know the slope and one point, you can skip the first step and just use b = y� − m·x�.
Worked Example
Using the default values from the calculator: Point 1 = (1, 3) and Point 2 = (5, 11).
- Calculate the slope:
m = (11 − 3) / (5 − 1) = 8 / 4 = 2 - Find the y-intercept using Point 1:
b = 3 − 2 × 1 = 3 − 2 = 1 - Write the equation:
y = 2x + 1
So the line through (1, 3) and (5, 11) has slope 2 and y-intercept 1. The calculator shows the same result: m = 2, b = 1, equation y = 2x + 1.
When to Use This Calculator
You would use a slope y intercept calculator whenever you need the equation of a straight line from two known points. This comes up in:
- Algebra homework and exam prep (writing linear equations)
- Physics problems involving constant velocity (position vs. time)
- Economics when finding linear demand or cost functions from two data points
- Data analysis when you want to quickly estimate a linear trend between two points
The result tells you two things: the slope tells you how much y changes for each 1-unit increase in x, and the y-intercept tells you the starting value of y when x is zero. In real-world terms, if x is time in hours and y is distance in miles, the slope is speed (miles per hour) and the intercept is the starting distance.
How to Read the Result
The slope (m) can be positive, negative, zero, or undefined:
- Positive slope: the line goes up as x increases (like y = 2x + 1).
- Negative slope: the line goes down as x increases (like y = −3x + 5).
- Zero slope: a horizontal line (like y = 4). The equation becomes y = b.
- Undefined slope: a vertical line (like x = 3). This cannot be written in slope-intercept form because it would require dividing by zero.
The y-intercept (b) is the point (0, b) on the graph. If b is positive, the line crosses the y-axis above the origin; if negative, below. If b = 0, the line passes through the origin.
Common Mistakes and Misconceptions
One frequent error is mixing up the order of the points. If you use (x₂ − x�) in the denominator, you must use (y₂ − y�) in the numerator with the same point order. Swapping only one pair gives the wrong sign for the slope.
Another common mistake is forgetting that the slope formula requires the x-coordinates to be different. If x� = x₂, the line is vertical and the slope is undefined; the calculator will show an error because you cannot divide by zero.
Unit mix-ups are rare here because the slope is unitless (it is a ratio of y-units to x-units). But if your x and y have different units (e.g., x in hours, y in miles), the slope will be in miles per hour. The y-intercept will have the same units as y.
Rounding can also cause small errors. If you round the slope too early, the intercept may be off. Keep several decimal places during the calculation, then round the final answer as needed.
Limitations of the Formula
The slope-intercept form only works for non-vertical lines. Vertical lines have an undefined slope and cannot be expressed as y = mx + b. For those, you would use x = constant.
The formula assumes a perfectly linear relationship. If your data points are not exactly on a line (e.g., from measurements with noise), using just two points may not represent the overall trend. In that case, linear regression (least squares) is more appropriate.
Also, the y-intercept may not make sense in every context. For example, if x represents time and your data starts at x = 10, the y-intercept at x = 0 is an extrapolation far outside your observed range, which may be meaningless or misleading.
How to Choose the Right Points
When you have multiple data points, choose two that are far apart to get a more representative line, as long as they are both reliable. Points that are very close together can amplify rounding errors in the slope. For instance, points (1, 3) and (1.1, 3.02) give a slope of 0.2, but a tiny measurement error could change that drastically.
If you are given a graph, pick two points that lie exactly on the grid intersections for accuracy. If you are given a word problem, identify the two clear data pairs (x, y) from the text.
Frequently Asked Questions
What if I only have the slope and one point?
You can still find the y-intercept using b = y� − m·x�. For example, if m = 3 and the point is (2, 7), then b = 7 − 3×2 = 1, so the equation is y = 3x + 1. You do not need a second point.
How do I find the y-intercept from a graph?
Look at where the line crosses the y-axis (the vertical axis). The y-coordinate of that point is the y-intercept. If the line crosses at (0, 5), then b = 5. If it crosses below the origin, b is negative.
What is the difference between slope-intercept and point-slope form?
Point-slope form is y − y� = m(x − x�). It uses one point and the slope. Slope-intercept form is y = mx + b, which directly shows the slope and y-intercept. You can convert from point-slope to slope-intercept by solving for y.
Can the y-intercept be a fraction or decimal?
Yes. If the line crosses the y-axis between integer values, b will be a fraction or decimal. For example, the line through (1, 2) and (3, 5) has slope 1.5 and intercept 0.5, giving y = 1.5x + 0.5.
What does an undefined slope look like?
An undefined slope means the line is vertical, like x = 4. The slope formula would have a zero denominator because x� = x₂. Such a line cannot be written in slope-intercept form because there is no unique y for each x.
Why is the y-intercept called “b”?
The letter b is a convention that dates back to early mathematics textbooks. It is simply a standard symbol, like m for slope. There is no deep meaning; it is just the variable chosen to represent the intercept.
Related
Formula used
in x1 | x� | - | 1 | 0 in y1 | y� | - | 3 | 0 in x2 | x₂ | - | 5 | 0 in y2 | y₂ | - | 11 | 0 out m | Slope (m) | - | (y2-y1)/(x2-x1) | 2 out b | y-intercept (b) | - | y1-m*x1 | 2 out eq | Line equation | - | y = m x + b | 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.