Skip to content
One hour with George, then a written plan the next working day. Book yours.
Free tool

Slope calculator

Find the slope of a line from two points, from a point and a slope, or from an equation. You get the slope as a fraction and a decimal, the line in slope-intercept, point-slope and standard form, both intercepts, the angle and the percent grade, and for two points the distance and the midpoint.

For students and parents planning test prep or coursework: one hour with George Li, one to one by video, is $180, $200 or $160, by subject. You leave with a written plan within one working day.

Book your first session
Course math

What do you know about the line?

A whole number, a decimal or a fraction such as 3/4.
A whole number, a decimal or a fraction such as 3/4.
A whole number, a decimal or a fraction such as 3/4.
A whole number, a decimal or a fraction such as 3/4.

Fill in the boxes above and the slope and the equation of the line appear here.

How this is calculated

Slope: m = (y2 - y1) / (x2 - x1), the rise over the run. A vertical line has a run of 0, so its slope is undefinedAngle of incline = arctan(m), from -90 to 90 degrees. Percent grade = 100 x mDistance = square root of ((x2 - x1)^2 + (y2 - y1)^2). Midpoint = ((x1 + x2) / 2, (y1 + y2) / 2)Slope-intercept form: y = mx + b, with b = y1 - m x1. Point-slope form: y - y1 = m (x - x1). Standard form: Ax + By = CThe y-intercept is the point where x = 0. The x-intercept is the point where y = 0The two points at a distance d from (x1, y1) along a line of slope m: x1 plus or minus d / sqrt(1 + m^2), and y1 plus or minus m d / sqrt(1 + m^2)

Every number you type becomes an exact fraction of two whole numbers before anything is worked out, so 0.1 and 1/10 give the same answer and no decimal is rounded early. The slope, the intercepts, the midpoint and the standard form are exact fractions and whole numbers; only the angle, which has no exact form, and the figures that end in a root are rounded, and the page marks them as rounded.

The slope is reduced to lowest terms with its sign on the top, so a rise of 6 over a run of -3 shows as -2. In standard form A, B and C are whole numbers that share no factor, and A is above 0, so the same line always gets the same equation. A vertical line has no slope-intercept form; it is x = c, with an x-intercept at (c, 0) and no y-intercept unless c is 0.

The angle is the angle of incline of the line itself, arctan of the slope. For two points the page also shows the direction from the first point to the second, counted from 0 up to 360 degrees, which tells apart a point up and to the right from one down and to the left. The percent grade is the slope times 100, the figure used for roads and ramps.

Assumptions

  • A box takes a whole number, a decimal or a fraction such as 3/4, with up to 9 digits before the point and up to 6 after it. Letters, commas, exponents and brackets are refused.
  • Decimals print to 6 places, half away from zero, with a trailing zero dropped. The angle and the percent grade print to 4 places.
  • The two points of a distance calculation must differ, and a distance for the one-point input must be above 0.
  • An equation may have x and y terms and numbers on both sides, with terms such as 3x, x/2, 0.5y or 1/2x. Products of x and y, powers and brackets are not read.
  • The page does not draw a graph. Nothing you type leaves your browser. Nothing is sent or stored.

Questions and a worked example

How do I find the slope between two points?

Subtract to get the rise and the run, then divide. As an example with made-up numbers, take (1, 2) and (4, 8). The rise is 8 - 2 = 6 and the run is 4 - 1 = 3, so the slope is 6 / 3 = 2. In the calculator, choose two points and type the four numbers.

What is the slope of a vertical line?

It is undefined, because the run is 0 and a fraction cannot have 0 underneath. As an example with made-up numbers, (3, 1) and (3, 7) have a run of 3 - 3 = 0, so the line is x = 3. The calculator says so, and still gives the distance and the x-intercept.

What is the slope of a horizontal line?

It is 0, because the rise is 0. As an example with made-up numbers, (1, 5) and (6, 5) have a rise of 5 - 5 = 0, a run of 5 and a slope of 0 / 5 = 0, so the line is y = 5. It never crosses the x-axis, and the calculator says so.

How do I write the equation of a line from two points?

Find the slope, then solve for b. As an example with made-up numbers, take (1, 4) and (3, 10). The slope is (10 - 4) / (3 - 1) = 3, and b = 4 - 3 x 1 = 1, so y = 3x + 1. In standard form that is 3x - y = -1.

How is slope the same as percent grade?

A percent grade is the slope times 100. As an example with made-up numbers, a ramp that rises 4 over a run of 50 has a slope of 4 / 50 = 0.08, so its grade is 8 percent and its angle is arctan(0.08), about 4.5739 degrees. Type (0, 0) and (50, 4) to see all three.

How do I find the slope from an equation?

Solve for y and read the number in front of x. As an example with made-up numbers, take 2x + 3y = 6. Subtract 2x to get 3y = -2x + 6, then divide by 3 to get y = -2/3 x + 2, so the slope is -2/3. Choose the equation input and type 2x + 3y = 6.