How to use the slope intercept form calculator
- Select Two points or Slope and one point from the input method dropdown.
- Enter your coordinates (x₁, y₁, x₂, y₂) or the slope (m) and a single point.
- The slope intercept form calculator updates the equation, slope, y-intercept and x-intercept automatically.
How slope intercept form works
The slope intercept form of a linear equation is written as y = mx + b, where m is the slope and b is the y-intercept. The slope measures how steep the line is: it is the change in y divided by the change in x between any two points on the line.
When you provide two points, (x₁, y₁) and (x₂, y₂), the calculator first finds the slope using the formula m = (y₂ - y₁) / (x₂ - x₁). Then it substitutes m and one of the points into y = mx + b and solves for b. For example, with points (1, 2) and (3, 6): the slope is (6 - 2) / (3 - 1) = 2. Plugging into the equation gives 2 = 2(1) + b, so b = 0. The final equation is y = 2x.
Common line equations reference
This table shows several standard lines and their properties. You can verify each row by entering the given points into the slope intercept form calculator above.
| Points | Slope (m) | Y-intercept (b) | Equation |
|---|---|---|---|
| (0, 0) and (1, 1) | 1 | 0 | y = x |
| (0, 5) and (5, 0) | -1 | 5 | y = -x + 5 |
| (2, 4) and (4, 4) | 0 | 4 | y = 4 |
| (-1, -3) and (1, 1) | 2 | -1 | y = 2x - 1 |
| (0, 0) and (2, -6) | -3 | 0 | y = -3x |
Vertical lines and edge cases
A vertical line has the same x-coordinate for every point, such as (3, 1) and (3, 7). Because the denominator in the slope formula (x₂ - x₁) becomes zero, the slope is undefined. Vertical lines cannot be expressed in slope intercept form; their equation is simply x = 3. This slope intercept form calculator will return an error if you enter two points that form a vertical line.
Horizontal lines are fully supported. When both y-coordinates are equal, the slope is zero and the equation reduces to y = b, where b is that constant y value.
Practical uses of y = mx + b
Finding the equation of a line is a foundational skill in algebra, physics and data analysis. In physics, a position-time graph for constant velocity produces a straight line where the slope equals the velocity and the y-intercept equals the starting position. In business, plotting total cost against units produced often yields a linear relationship: the slope represents the variable cost per unit and the y-intercept represents fixed overhead.
If your data does not fall perfectly on a line, you need a best-fit approach rather than exact two-point calculation. For those situations, a linear regression calculator minimizes the overall error across many points. Once you have the equation, you might also use a linear equation solver to find specific x or y values, or explore systems of equations with a matrix calculator.
Converting to other forms
Slope intercept form is convenient for graphing because m and b are immediately visible, but some problems require standard form (Ax + By = C) or point-slope form (y - y₁ = m(x - x₁)). Converting from y = mx + b to standard form involves moving the x term to the left side and, if necessary, multiplying through by a common denominator to clear fractions. For instance, y = 0.5x + 2 becomes -0.5x + y = 2, and multiplying by 2 gives -x + 2y = 4, or equivalently x - 2y = -4.
Worked examples
Each result below was produced by the same code the tool runs, so you can check your own numbers against them.
| Example | Input | Result |
|---|---|---|
| Two points (1, 2) and (3, 6) | Input method: points; x₁: 1; y₁: 2; x₂: 3; y₂: 6 | Equation: y = 2x; Slope (m): 2; Y-intercept (b): 0; X-intercept: 0 |
| Horizontal line through (4, 5) and (9, 5) | Input method: points; x₁: 4; y₁: 5; x₂: 9; y₂: 5 | Equation: y = 5; Slope (m): 0; Y-intercept (b): 5; X-intercept: None |
| Slope 0.5 through point (2, 3) | Input method: slope_point; x₁: 2; y₁: 3; Slope (m): 0.5 | Equation: y = 0.5x + 2; Slope (m): 0.5; Y-intercept (b): 2; X-intercept: -4 |
| Negative slope between (0, 4) and (2, 0) | Input method: points; x₁: 0; y₁: 4; x₂: 2; y₂: 0 | Equation: y = -2x + 4; Slope (m): -2; Y-intercept (b): 4; X-intercept: 2 |
FAQ
What is slope intercept form?
Slope intercept form is a way to write a linear equation as y = mx + b. The letter m represents the slope of the line and b represents the y-intercept, which is the point where the line crosses the y-axis.
How do I find the slope from two points?
Subtract the first y-coordinate from the second, then divide by the difference of the x-coordinates: m = (y2 - y1) / (x2 - x1). For example, between (1, 2) and (3, 6) the slope is (6 - 2) / (3 - 1) = 2.
Can this calculator handle vertical lines?
No. A vertical line has an undefined slope because the change in x is zero, causing division by zero. Vertical lines are written as x = c and cannot be expressed in y = mx + b format.
What if my slope is a fraction or decimal?
The slope intercept form calculator accepts decimals and negative numbers directly. Enter them as-is, and the tool will compute the exact y-intercept and display the formatted equation.
Is my data sent to a server?
No. All calculations run locally in your browser. Nothing you type is uploaded anywhere.
How do I find the x-intercept from y = mx + b?
Set y to zero and solve for x: x = -b / m. The x-intercept is the point where the line crosses the horizontal axis. If m is zero (a horizontal line), there is no x-intercept unless b is also zero.