Math

Slope-intercept form calculator

Settings
Reset
Share
Save
Embed
Report a bug

Share calculator

Add our free calculator to your website

Please enter a valid URL. Only HTTPS URLs are supported.


Use as default values for the embed calculator what is currently in input fields of the calculator on the page.


Input border focus color, switchbox checked color, select item hover color etc.


Please agree to the Terms of Use.

Preview

Save calculator

Calculator Settings

Please enter a value within the allowed range.

Please enter a value within the allowed range.

Please enter a value within the allowed range.

Please enter a value within the allowed range.

Share calculator

What is a slope-intercept form calculator?

A slope-intercept form calculator builds the equation of a straight line from two points that the line passes through. It returns the line written in slope-intercept form y=mx+by = mx + b — the most common way to describe a line in algebra — together with the slope mm and the y-intercept bb on their own.

Two distinct points are enough to fix a line completely, so from them this calculator can recover both numbers that define the slope-intercept equation: how steep the line is and where it crosses the vertical axis.

Key concepts

  • Point (x,y)(x, y) — an ordered pair that locates a position on the coordinate plane.
  • Slope (m) — how steep the line is, the vertical change divided by the horizontal change between the two points.
  • y-intercept (b) — the value of yy where the line crosses the vertical axis, i.e. where x=0x = 0.
  • Slope-intercept formy=mx+by = mx + b, the line written so that its slope and intercept can be read off directly.

How does the calculator work?

First find the slope from the two points (x1,y1)(x_1, y_1) and (x2,y2)(x_2, y_2) as rise over run:

m=y2y1x2x1m = \frac{y_2 - y_1}{x_2 - x_1}

Then use either point with the slope to recover the y-intercept by solving y=mx+by = mx + b for bb:

b=y1mx1b = y_1 - m x_1

Finally, the line is written in slope-intercept form:

y=mx+by = mx + b

Enter the coordinates of the two points and the calculator immediately returns mm, bb, and the full equation. If x1=x2x_1 = x_2 the two points lie on a vertical line, which has no defined slope and cannot be written as y=mx+by = mx + b — the calculator leaves the results blank in that case.

Worked examples

Example 1: line through the origin

For the points (0,0)(0, 0) and (2,4)(2, 4):

m=4020=2,b=020=0m = \frac{4 - 0}{2 - 0} = 2, \quad b = 0 - 2 \cdot 0 = 0

The equation is y=2xy = 2x. A line through the origin has a y-intercept of 00.

Example 2: positive intercept

For the points (0,3)(0, 3) and (2,7)(2, 7):

m=7320=2,b=320=3m = \frac{7 - 3}{2 - 0} = 2, \quad b = 3 - 2 \cdot 0 = 3

The equation is y=2x+3y = 2x + 3. The line crosses the vertical axis at y=3y = 3.

Example 3: negative slope

For the points (1,5)(1, 5) and (3,1)(3, 1):

m=1531=2,b=5(2)1=7m = \frac{1 - 5}{3 - 1} = -2, \quad b = 5 - (-2) \cdot 1 = 7

The equation is y=2x+7y = -2x + 7. The line falls two units for every unit it moves to the right.

Example 4: horizontal line

For the points (1,2)(1, 2) and (4,2)(4, 2):

m=2241=0,b=201=2m = \frac{2 - 2}{4 - 1} = 0, \quad b = 2 - 0 \cdot 1 = 2

The equation is y=0x+2y = 0x + 2, i.e. y=2y = 2. Both points share the same yy, so the line is horizontal.

Practical uses

  • Algebra and graphing — read off the slope and intercept directly to sketch the line by hand.
  • Statistics — express a fitted regression line as y=mx+by = mx + b, where the slope is the average change in yy per unit change in xx.
  • Physics — turn two measured data points into a linear model, for example position against time at constant velocity.
  • Geometry problems — once you have the slope from the slope calculator or a point from the midpoint calculator, this calculator gives the line’s full equation; for a single point and a known slope use the point-slope form calculator instead.

Notes

  • The order of the two points does not matter: swapping (x1,y1)(x_1, y_1) and (x2,y2)(x_2, y_2) negates both the rise and the run, leaving the slope unchanged.
  • A vertical line has no slope-intercept form. Its equation is simply x=x1x = x_1, and the calculator leaves the results empty.
  • A horizontal line has slope 00, so b=y1b = y_1 and the equation reduces to y=by = b.
  • The two points must be different. If both points are identical, infinitely many lines pass through them and the line is not determined.

Report a bug

This field is required.