The Calc Guide › Calculator

Slope Calculator

The slope of a line through two points is m = (y2 - y1) / (x2 - x1), the rise over the run. The line through (1, 2) and (4, 8) has slope 2, angle 63.4349 degrees and equation y = 2x. Start from two points, from one point and a slope, or from an equation, and get the slope, angle, both intercepts, distance and midpoint. Checked November 2026.

Last updated: November 26, 2026

Find the slope of a line, from points or an equation

What do you know?

A vertical line has no slope: if the two x values are equal, the tool says so instead of dividing by zero. A horizontal line has slope 0.

How this is worked out

Slope = rise / run = (y2 - y1) / (x2 - x1).

The intercept comes from b = y1 - m x1.

Slope (m)-
Line equation-
Angle of incline-
Y-intercept-
X-intercept-
Distance between the points-
Midpoint-

Next: slope as a percentage with the Percentage Calculator

Free. No sign-up. Calculated in your browser; nothing is sent to our servers.

What this calculator does

Slope questions start from three different places, so the Slope Calculator takes all three: two points on the line, one point plus the slope, or the slope and intercept of an equation. Whichever you start from, it returns the whole picture of the line: the slope, the equation in slope-intercept form, the angle in degrees, the y-intercept, the x-intercept, and, from two points, the distance between them and the midpoint. Vertical and horizontal lines are handled in words, not error codes: a vertical line’s slope is stated as undefined, with the reason shown. A ratio comparing two quantities, rise against run here, is set up and solved by the proportion calculator. The flat surface inside these boundaries is measured by the area calculator.

Worked example: the line through (1, 2) and (4, 8)

The tool above opens on the two points (1, 2) and (4, 8). The rise from the first point to the second is 8 − 2 = 6 and the run is 4 − 1 = 3, so the slope is 6 / 3 = 2. The line’s equation is y = 2x, because the intercept works out to 2 − 2 x 1 = 0: the line passes through the origin, so both intercepts are 0. Its angle is 63.4349 degrees, the distance between the two points is 6.7082, and the midpoint is (2.5, 5). Every one of those figures is already on the screen in the tool; change any coordinate and they all move together.

One example of each kind of slope

Slopes come in four kinds, and each row below reproduces exactly in the tool when you type the two points in.

Scroll sideways to see all columns →

Kind Two points Slope Equation Distance Midpoint
Positive (1, 2) and (4, 8) 2 y = 2x 6.7082 (2.5, 5)
Negative (0, 6) and (3, 0) -2 y = -2x + 6 6.7082 (1.5, 3)
Zero (1, 4) and (6, 4) 0 y = 4 5 (3.5, 4)
Undefined (3, 1) and (3, 7) Undefined x = 3 6 (3, 4)

How slope works

m = (y2 − y1) / (x2 − x1)

Slope is rise over run: how much the line climbs (or falls) for each step across. Once the slope is known, the rest of the line follows. The intercept comes from putting one point into the equation: b = y1 − m x1, which completes y = mx + b. The y-intercept is b itself, the point where the line crosses the vertical axis. The x-intercept, where it crosses the horizontal axis, is -b / m, found by setting y to 0. The distance between two points is the hypotenuse of the rise and run triangle, and the midpoint is simply the average of the two x coordinates and the average of the two y coordinates.

  • The angle: the angle printed here is the signed angle of incline, arctan(m) in degrees. A rising line reads between 0 and 90 degrees, a flat line reads 0, a falling line reads negative, and a vertical line reads 90. Many textbooks instead measure the angle of inclination counterclockwise from the positive x-axis, between 0 and 180 degrees, so the falling line with slope -2 reads 116.5651 degrees there (180 − 63.4349). The slope, the intercepts and the equation are the same either way, only the angle’s convention differs.
  • Subtract in the same order: a common slope mistake is taking the y coordinates in one order and the x coordinates in the other, which flips the sign. (8 − 2) / (4 − 1) is 2; (2 − 8) / (4 − 1) is -2, a different line. Starting from the other point is fine as long as both differences use the same order: (3, 0) then (0, 6) gives (6 − 0) / (0 − 3) = -2, the same slope as (0, 6) then (3, 0).
  • When x and y use the same unit, as on a map or a grid, slope has no units: the units cancel, and a slope of 2 climbs two units for every one unit across, in meters, feet or grid squares alike. When x and y are different quantities, such as distance against time, the slope carries both units, for example miles per hour.
  • The other two modes: with a point and a slope, the tool uses b = y − mx on your point. With an equation, type its m and b straight in: m = -2 and b = 6 give the line y = -2x + 6, whose x-intercept is 3.

Limits of the tool

The tool works on one line at a time. Two identical points define no line, so it shows a message asking you to move one point. In the point and slope mode and in the equation mode, leaving every field blank shows dashes. The equation line rounds the slope and the intercept to 6 decimal places, so the slope one third is written y = 0.333333x, and a slope smaller than 0.0000005 in size, such as 0.0000001, is written with a 0x term even though the angle is worked out from the unrounded slope. There is no cap on the numbers: very large or very small coordinates are worked out as typed, so check an entry before relying on a result.

Sources and method

The method is standard coordinate geometry. The slope formula and the undefined slope of a vertical line are the ones given in open algebra textbooks such as OpenStax Elementary Algebra, the angle follows the usual textbook definition of the angle of inclination, and percent grade is defined as in the U.S. Geological Survey’s guide to percent slope; the figures on this page were computed with the tool’s own code and checked by hand. The conventions are stated rather than hidden: the angle is the signed angle of incline described in the How it works card; a vertical line’s slope is reported as the word Undefined, because the run is zero and division by zero has no answer, never as a number or an error; a horizontal line has slope 0 and no x-intercept, and if a line is the x-axis itself the tool says so. The equation line rounds the slope and the intercept to 6 decimal places, so the line through (3, 4) and (6, 8) is written y = 1.333333x, and the other results are rounded for display. Figures checked November 2026.

Related calculators

Slope is a rate of change, and the Percentage Calculator covers the same idea in percent form, including slope as a percent grade. For the rest of the school set, the Final Grade Calculator works out what a remaining exam has to score, and the GPA Calculator turns letter grades into a grade point average.

Change log

November 18, 2026: kept the privacy clause about our servers, confirmed by the developer; replaced the rounding rule, which the example did not match, with the 6 decimal rounding the equation line uses; corrected the statement that slope never has units; replaced the unsourced claims about other calculators and about the most common mistake; added the angle convention from 0 to 180 degrees, the reversed point order, a limits section and a point-slope form answer.

Frequently asked questions

How do you find the slope of a line from two points?

Subtract the y coordinates, subtract the x coordinates in the same order, and divide the first difference by the second: m = (y2 − y1) / (x2 − x1). For the points (1, 2) and (4, 8) that is (8 − 2) / (4 − 1) = 6 / 3 = 2. The order warning matters: mixing the orders flips the sign and gives the wrong line.

What is the slope of a vertical line?

Undefined. A vertical line’s run is zero, and the slope formula divides by the run, and division by zero has no answer; it is not that the slope is infinite or very large, it is that slope does not apply. A vertical line is written as an equation in x instead, like x = 3 for the line through (3, 1) and (3, 7), and its angle is 90 degrees.

How do you find the slope from an equation?

When the equation is in slope-intercept form, y = mx + b, the slope is m, the number multiplying x. If the equation is written another way, rearrange it into that form first: 2x + y = 6 becomes y = -2x + 6, so the slope is -2 and the y-intercept is 6. The equation mode above takes m and b directly once you have them.

What does a negative slope mean?

The line falls as it moves to the right: each step across drops the height instead of raising it. The line through (0, 6) and (3, 0) has slope -2, falling two units for every one across, and its angle reads -63.4349 degrees under the signed convention this page states.

How is slope written as a percent grade?

Multiply the slope by 100. A slope of 2 is a 200 percent grade, and a road signed at a 10 percent grade has a slope of 0.1, climbing one unit for every ten across. Percent grade is the slope written as a percentage, not an angle: a 100 percent grade is a 45 degree angle, not 100 degrees, and the slope of 2 above is a 200 percent grade at an angle of 63.4349 degrees. The Percentage Calculator covers percent method in full.

How do you find the midpoint of two points?

Average the x coordinates for the midpoint’s x, and average the y coordinates for its y. Between (1, 2) and (4, 8) the midpoint is ((1 + 4) / 2, (2 + 8) / 2) = (2.5, 5), the point exactly halfway along the segment, which is why the two points mode above reports it with the distance.

What is the point-slope form of a line?

It is y − y1 = m(x − x1), where m is the slope and (x1, y1) is a point on the line. For the point (2, 3) and the slope 4 it is y − 3 = 4(x − 2), which simplifies to y = 4x − 5, with a y-intercept of -5 and an x-intercept of 1.25. The point and slope mode above prints the point-slope form and the simplified equation for any point and slope you enter.

Embed this calculator

Put this calculator on your own site or blog, free, with this snippet:

Free for any site while the attribution link under the calculator stays in place. More calculators and WordPress instructions.

Educational tool only. Results are estimates based on the numbers you enter and the assumptions explained on this page, not financial advice.