Slope Calculator

A free tool by DeepRit, a Google Ads agency that does PPC and nothing else. We build and run Google Ads accounts so every click is accounted for. Book a free audit call

Free slope calculator. Enter two points to get the slope as a fraction and decimal, the line equation y = mx + b, the angle, distance and midpoint.

Line equation
0
Slope as a fraction
0
Angle
0
Grade (%)
0
Distance
0
Midpoint
0

Free, no sign-up. Runs in your browser: nothing you type is uploaded or saved.

How to use the slope calculator

  1. Enter the first point as x₁ and y₁.
  2. Enter the second point as x₂ and y₂.
  3. Read the slope. The slope calculator shows it as a decimal and, when the points are whole numbers, as a simplified fraction.
  4. Use the extras: the equation of the line in y = mx + b form, the angle of the line, the grade as a percentage, the distance between the points and the midpoint.

Negative numbers and decimals are fine. Everything is calculated in your browser.

What slope means

Slope measures how steep a line is: how much it rises (or falls) for every step to the right. It's usually written as m:

m = rise ÷ run = (y₂ − y₁) ÷ (x₂ − x₁)

For the points (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. The line goes up 2 units for every 1 unit across.

It doesn't matter which point you call "first", as long as you subtract in the same order on the top and bottom. (8 − 2) ÷ (4 − 1) and (2 − 8) ÷ (1 − 4) both give 2.

Positive, negative, zero and undefined slopes

  • Positive slope: the line rises from left to right. m = 2 is steeper than m = 0.5.
  • Negative slope: the line falls from left to right. The points (−2, 5) and (6, 1) give m = −4 ÷ 8 = −1/2.
  • Zero slope: a flat, horizontal line, like y = 3. The rise is zero.
  • Undefined slope: a vertical line, like x = 4. The run is zero, and you can't divide by zero. The slope calculator tells you the line is vertical and gives its equation.

The bigger the number (ignoring the sign), the steeper the line.

The equation of a line: y = mx + b

Once you know the slope, the line's equation follows. In slope-intercept form:

y = mx + b

where m is the slope and b is the y-intercept, the point where the line crosses the y-axis. To find b, substitute one of your points: b = y₁ − m × x₁.

For (−2, 5) and (6, 1): m = −0.5, so b = 5 − (−0.5 × −2) = 5 − 1 = 4. The line is y = −0.5x + 4. The slope calculator writes the equation for you, handling signs properly so you never see "+ −4".

Other forms you might meet:

  • Point-slope form: y − y₁ = m(x − x₁).
  • Standard form: Ax + By = C. From y = −0.5x + 4, multiply by 2: x + 2y = 8.

Slope as a fraction

Slopes are often clearer as fractions. A slope of 0.0833333… is really 1/12: one unit up for every twelve across. When all four coordinates are whole numbers, the slope calculator reduces rise ÷ run to its simplest fraction using the greatest common divisor. For decimals, the decimal to fraction converter helps.

Angle and grade

Angle. The angle the line makes with the horizontal is the arctangent of the slope: angle = tan⁻¹(m). A slope of 1 is 45°; a slope of 2 is 63.435°. Negative slopes give negative angles (the line points downward). The angle converter converts degrees to radians and other units.

Grade (percentage slope). Roads, ramps, roofs and land are often described by grade: rise ÷ run × 100. A slope of 1/12 is an 8.33% grade. A 100% grade is a 45° angle, not a vertical wall, which is a common misunderstanding.

Some standards to know:

  • Wheelchair ramps: many building codes, including the US ADA standards, set a maximum of 1:12 (8.33%) for ramps.
  • Roads: main roads are usually kept under about 6–8%; very steep streets can exceed 20%.
  • Roof pitch: often written as rise per 12 units of run, such as 4:12 (a slope of 1/3, about 18.4°).
  • Drainage pipes: commonly laid at around 1–2% so water flows.

Distance and midpoint

The slope calculator also gives:

Distance between the points, by the Pythagorean theorem: √((x₂ − x₁)² + (y₂ − y₁)²). For (1, 2) and (4, 8), that's √(9 + 36) = √45 = 6.7082. The Pythagorean theorem calculator does the same for right triangles.

Midpoint, halfway between them: ((x₁ + x₂) ÷ 2, (y₁ + y₂) ÷ 2) = (2.5, 5).

Parallel and perpendicular lines

  • Parallel lines have the same slope. Any line parallel to y = 2x + 1 has slope 2.
  • Perpendicular lines have slopes that multiply to −1. A line perpendicular to slope 2 has slope −1/2.

These rules are useful in geometry problems, graphic design and laying out right angles on a plan.

Slope in real life

  • Rate of change: in a graph of distance against time, slope is speed. In cost against units, it's the cost per unit. In sales over months, it's the growth per month.
  • Construction: ramps, stairs, roofs, driveways and drainage.
  • Maps and hiking: gradients on trails and roads.
  • Data and trends: a trend line's slope shows how fast something is changing. The ratio calculator helps express rates like 1:12 in other forms.
  • Homework: checking slope, intercept and line-equation answers.

Common mistakes

  • Subtracting in different orders on the top and bottom, which flips the sign.
  • Putting x on top: slope is change in y over change in x.
  • Confusing grade with angle: 100% grade is 45°, not 90°.
  • Forgetting that vertical lines have no slope, rather than a slope of zero.

Slope in spreadsheets

Excel and Google Sheets have built-in functions for lines through data. With x values in A2:A10 and y values in B2:B10, =SLOPE(B2:B10, A2:A10) gives the slope of the best-fit line and =INTERCEPT(B2:B10, A2:A10) gives b. With only two points, these give exactly the same answer as the slope calculator. With more points, they fit the straight line that passes as close as possible to all of them (a least-squares regression line), which is how trend lines on charts are drawn.

Slope as a rate of change

The units of a slope are "y units per x unit". If y is money and x is months, a slope of 250 means 250 per month. If y is kilometres and x is hours, the slope is a speed in km/h. If y is temperature and x is altitude, the slope is how fast the air cools as you climb. Reading the units this way turns the slope calculator into a quick tool for any rate: price per unit, growth per year, or cost per extra item.

Steepness in everyday terms

Slope Grade Angle Feels like
1/50 2% 1.15° Barely noticeable
1/12 8.33% 4.76° Accessible ramp limit
1/10 10% 5.71° Steep street
1/4 25% 14.04° Very steep hill
1 100% 45° Staircase-steep

Slope and the equation of a line in homework

Many textbook questions give a line in one form and ask for another. If you're given 2x + 4y = 8, rearrange to y = −0.5x + 2, so the slope is −0.5 and the intercept is 2. To check with the slope calculator, pick any two points on the line, such as (0, 2) and (4, 0), and enter them: you'll get the same slope and equation.

A worked example

A builder is planning a ramp to a doorway 0.5 m above the path. He wants to check his drawing against the 1:12 rule. On his plan, the ramp starts at (0, 0) and ends at (6, 0.5), in metres.

He enters 0, 0, 6 and 0.5 into the slope calculator. The slope is 0.083333, a grade of 8.3333% and an angle of 4.7636°, exactly 1:12. The ramp's length along the slope is the distance, 6.0208 m.

To double-check with whole numbers in millimetres, he enters (0, 0) and (1200, 100) for one section: the slope calculator shows the fraction 1/12.

Need more customers from Google?

This tool is free and runs in your browser. If your business also needs more leads or sales, Google Ads is where people search with their wallet out. That is the whole job of DeepRit: a PPC-only agency that sets up and runs Google Ads accounts so every click is accounted for. You keep full ownership of your account, get a written report every week, and can stop at any time. See our pricing or ask for a free audit.

Frequently asked questions

How do you find the slope between two points?

Divide the change in y by the change in x: (y₂ − y₁) ÷ (x₂ − x₁). The slope calculator does it and simplifies the fraction.

What is the slope of a horizontal line?

Zero. The y value doesn't change, so the rise is 0.

What is the slope of a vertical line?

Undefined, because the run is zero and you can't divide by zero. Its equation is x = a number.

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

Find the slope m, then b = y₁ − m × x₁, and write y = mx + b. The slope calculator writes the equation for you.

How do I convert slope to an angle?

Take the arctangent: angle = tan⁻¹(slope). A slope of 1 is 45°.

Is the slope calculator free?

Yes. The slope calculator is free, works in your browser and needs no sign-up.

Free PPC audit

See where your ad budget leaks.

We look at your Google Ads account before the call, then walk you through what we'd fix first, in dollars. No obligation, no hard sell.

Book a free audit call 30-minute call · Free · The audit is yours to keep