What This Calculator Does
Given any two distinct points on a straight line, this calculator finds the slope (m) and the y-intercept (b), then assembles the full slope-intercept equation \(y = mx + b\). It works for positive, negative, fractional, and zero slopes, and detects vertical lines where the slope is undefined.
Which slope tool do you need?
- Slope calculator: slope, angle, distance and line equation between two points.
- Point-slope calculator: the slope m from two points, ready for the point-slope form y − y₁ = m(x − x₁).
- Slope-intercept calculator (this page): the slope m and y-intercept b of the line y = mx + b through two points.
- Slope percentage calculator: the percent grade from rise and run (rise ÷ run × 100).
- Slope to degrees: the angle of a slope in degrees and radians.
- Degrees to slope percent: the percent grade of an angle given in degrees.
How to Use It
Enter the coordinates of your first point (x₁, y₁) and your second point (x₂, y₂). The calculator computes the change in y (rise) and the change in x (run), divides them to get the slope, then substitutes back to find where the line crosses the y-axis.
The Formula Explained
The slope measures steepness: $$m = \frac{y_2 - y_1}{x_2 - x_1}$$ Once you know m, the y-intercept follows from rearranging \(y = mx + b\) at the first point: $$b = y_1 - m \cdot x_1$$ If \(x_2 = x_1\) the run is zero, so the line is vertical and its slope is undefined (the equation becomes \(x = \text{constant}\)).
Worked Example
For points (1, 2) and (3, 6): rise = 6 − 2 = 4, run = 3 − 1 = 2, so $$m = \frac{4}{2} = 2$$ Then \(b = 2 - 2 \cdot 1 = 0\). The line is \(y = 2x\).
Slope Scenarios at a Glance
Each row uses \(m = \dfrac{y_2 - y_1}{x_2 - x_1}\) and \(b = y_1 - m\,x_1\).
| Point 1 | Point 2 | Slope m | Y-intercept b | Equation | Line type |
|---|---|---|---|---|---|
| (1, 2) | (3, 6) | 2 | 0 | y = 2x | Positive slope (rising) |
| (0, 5) | (2, 1) | −2 | 5 | y = −2x + 5 | Negative slope (falling) |
| (1, 4) | (5, 4) | 0 | 4 | y = 4 | Zero slope (horizontal) |
| (2, 1) | (6, 3) | 1/2 | 0 | y = x/2 | Fractional slope (gentle rise) |
| (3, 1) | (3, 7) | Undefined | None | x = 3 | Vertical line |
Check of the first row: \(m = \dfrac{6 - 2}{3 - 1} = 2\), then \(b = 2 - 2 \cdot 1 = 0\). Check of the second row: \(m = \dfrac{1 - 5}{2 - 0} = -2\), then \(b = 5 - (-2)\cdot 0 = 5\).
Key Terms
- Slope (m)
- A number measuring how steep a line is: the change in y divided by the change in x between any two points on the line.
- Y-intercept (b)
- The y-value where the line crosses the y-axis, i.e. the point where \(x = 0\), written \((0, b)\).
- Rise
- The vertical change between two points: \(y_2 - y_1\).
- Run
- The horizontal change between two points: \(x_2 - x_1\).
- Slope-intercept form
- The equation \(y = mx + b\), where \(m\) is the slope and \(b\) is the y-intercept.
- Ordered pair (coordinates)
- A pair \((x, y)\) that locates a point on the plane: x is the horizontal position and y is the vertical position.
- Vertical line
- A line where every point has the same x-value, with equation \(x = c\). Its run is 0, so its slope is undefined.
- Horizontal line
- A line where every point has the same y-value, with equation \(y = c\). Its rise is 0, so its slope is 0.
- Undefined slope
- The slope of a vertical line. Because \(x_2 - x_1 = 0\), the ratio rise/run involves division by zero and has no numeric value.
FAQ
What if the two points are the same? A single point does not define a unique line — enter two different points.
Why is my slope undefined? When \(x_1\) equals \(x_2\) the line is vertical; vertical lines have no slope-intercept form.
What does a slope of 0 mean? A horizontal line; y stays constant and b equals that y value.