free tool, no sign-up

Slope Calculator

Find the slope between two points as a fraction and a decimal, then see the line in point-slope and slope-intercept form.

A whole number, decimal, or fraction such as 1/2

A whole number, decimal, or fraction such as 1/2

A whole number, decimal, or fraction such as 1/2

A whole number, decimal, or fraction such as 1/2

Enter two points to find the slope.

Enter two points to find the slope.

Examples

This slope calculator is for algebra class and homework about straight lines. Enter two points and the page fills in the slope formula with those numbers, simplifies the fraction, and shows a decimal. It also writes the point-slope equation and y = mx + b, and it says when a vertical line has an undefined slope because the run is 0. You can start from a slope and a y-intercept, or from one point and a slope, if that is what the problem gives you.

How to find the slope from two points

Slope is rise over run. For two points (x1, y1) and (x2, y2), the slope formula is m = (y2 − y1) / (x2 − x1). From (1, 2) to (3, 6), the rise is 6 − 2 = 4 and the run is 3 − 1 = 2, so m = 4/2 = 2. The line goes up 2 units each time x increases by 1.

A positive slope rises from left to right, and a negative slope falls. From (−1, −2) to (3, 4), the rise is 6 and the run is 4, so m = 6/4 = 3/2, or 1.5. From (0, 0) to (2, 1), m = 1/2. From (0, 0) to (3, 1), m = 1/3, and the decimal 0.33333333 is rounded to 8 significant figures.

Slope-intercept form, y = mx + b

Slope-intercept form is y = mx + b. Here m is the slope and b is the y-intercept, the y value where the line crosses the y-axis. If m = 2 and b = 0, the equation is y = 2x. The line through (0, 0) and (2, 1) has slope 1/2 and y-intercept 0, so y = (1/2)x.

If you know the slope and one point, substitute and solve for b. A line with slope −2 through (1, 5) gives 5 = −2(1) + b, so b = 7 and the equation is y = −2x + 7. A horizontal line has slope 0. Through (2, 3) and (6, 3), the rise is 0, so the equation is y = 3.

Point-slope form

Point-slope form is y − y1 = m(x − x1). It uses one point on the line and the slope. For (1, 5) and m = −2, the equation is y − 5 = −2(x − 1). Add 5 after distributing and you get y = −2x + 7. For (1, 2) and slope 2, point-slope form is y − 2 = 2(x − 1), which is the same line as y = 2x.

A vertical line has no slope, so it has no point-slope equation and no y = mx + b equation. The points (1, 2) and (1, 5) share an x-coordinate, so the run is 0. The slope is undefined, and the equation of the line is x = 1.

Frequently Asked Questions

How do you find slope with two points?

Subtract the y-coordinates and the x-coordinates in the same order, then divide. For (1, 2) and (3, 6), m = (6 − 2) / (3 − 1) = 4/2 = 2. For (0, 0) and (2, 1), m = (1 − 0) / (2 − 0) = 1/2.

What is point-slope form?

Point-slope form is y − y1 = m(x − x1). The m is the slope, and (x1, y1) is a point on the line. A line through (1, 5) with slope −2 is y − 5 = −2(x − 1). That is the same line as y = −2x + 7.

What is slope-intercept form?

Slope-intercept form is y = mx + b. m is the slope and b is the y-intercept. The line through (0, 0) and (2, 1) has slope 1/2 and y-intercept 0, so the equation is y = (1/2)x. The equation y = −2x + 7 has slope −2 and crosses the y-axis at 7.

What is slope?

Slope measures the steepness of a line. It is the change in y divided by the change in x. A slope of 2 rises 2 units when x increases by 1. A negative slope falls as x increases. A slope of 0 is a horizontal line, and an undefined slope is a vertical line.

How do you find the slope of a horizontal or vertical line?

A horizontal line keeps the same y value, so the rise is 0 and the slope is 0. For (2, 3) and (6, 3), m = 0 and the equation is y = 3. A vertical line keeps the same x value, so the run is 0. For (1, 2) and (1, 5), the slope is undefined and the equation is x = 1.

Related Tools