Slope-Intercept Form Calculator

Find a line's slope, y-intercept, and equation y = mx + b from any two points.

Find the equation of a line
Enter two distinct points on the line.

About slope-intercept form

Slope-intercept form writes a straight line as y = mx + b. The coefficient m is the slope, which measures how much y changes whenever x increases by one unit. The constant b is the y-intercept, the point where the line crosses the vertical axis. This compact equation makes it easy to graph a line, compare rates, and predict one coordinate from another. This calculator determines both values from two points. It first computes the rise, y2 minus y1, and divides it by the run, x2 minus x1. That quotient is the slope. It then substitutes either point into b = y - mx to recover the intercept. Because both supplied points lie on the same line, either point produces the same intercept when the input is exact. The displayed equation can immediately be checked by substituting each original x-coordinate and confirming that the corresponding y-coordinate is returned. A positive slope rises from left to right, while a negative slope falls. A zero slope describes a horizontal line and produces an equation such as y = 4. If both points have the same x-coordinate, the run is zero and the slope is undefined. That line is vertical and must instead be written as x equals a constant, so it cannot be represented by y = mx + b. The calculator reports that case rather than dividing by zero. Slope-intercept equations appear throughout algebra and coordinate geometry, but they also model practical relationships. A taxi fare can have a fixed starting charge represented by b and a per-mile rate represented by m. A temperature conversion, a steady savings plan, or motion at constant speed can use the same structure. Units matter: slope carries units of vertical quantity per horizontal quantity, while the intercept uses the vertical quantity's units. For decimal coordinates, results are rounded only for display while the calculation uses JavaScript double-precision arithmetic. Very large or repeating values may therefore appear in a concise decimal form. Use the result as an accurate classroom and everyday planning aid, and retain additional precision when a scientific or engineering workflow requires a specified tolerance.

Slope-intercept form examples

Two pointsEquationExplanation
(1, 3) and (4, 9)y = 2x + 1The rise is 6 and the run is 3, so the slope is 2.
(0, 5) and (2, 1)y = -2x + 5The line falls two units for every one unit moved right.
(-2, 4) and (3, 4)y = 4Equal y-coordinates create a horizontal line with zero slope.

How to use the calculator

  1. Enter the x- and y-coordinates of the first point.
  2. Enter the coordinates of a different point on the same line.
  3. Select Calculate equation to find the slope and y-intercept.
  4. Substitute either original point into the displayed equation to check the result.

Slope-intercept form FAQ

What is slope-intercept form?

Slope-intercept form is y = mx + b, where m is slope and b is the y-intercept. It reveals a line's rate of change and starting value at a glance.

How is slope calculated from two points?

Subtract the first y-coordinate from the second, then divide by the difference between the x-coordinates. This rise-over-run ratio is constant everywhere on a straight line.

Why can I not enter two points with the same x-coordinate?

Those points define a vertical line, so the run is zero and its slope is undefined. A vertical line uses the form x = constant instead of slope-intercept form.

Can the slope or intercept be negative?

Yes, both values may be negative, positive, or zero. A negative slope means the line falls from left to right, while a negative intercept lies below the origin.

How can I check the equation?

Insert each known x-coordinate into the equation and calculate y. If both calculated values equal the original y-coordinates, the equation is correct.