Skip to content
KazamTools

Slope Calculator

Slope, angle, distance and the equation of the line from two points, with every step shown.

Point 1 (x₁, y₁)
Point 2 (x₂, y₂)

Slope (m)

2/3 ≈ 0.666667

Line: y = (2/3)x + 7/3

Rise ÷ run
4 ÷ 6
Angle (θ)
33.6901°
From the positive x-axis
Grade
66.6667%
Distance P1 to P2
7.211103
Midpoint
(1, 3)
Intercepts
y = 2.333333
Crosses the x-axis at x = −3.5
P1P2

Equations of the line

  1. Slope-intercept: y = (2/3)x + 7/3
  2. Point-slope: y − 1 = (2/3)(x + 2)
  3. Standard form: 2x − 3y = −7

How it was worked out

  1. m = (y₂ − y₁) ÷ (x₂ − x₁) = (5 − 1) ÷ (4 − −2) = 4 ÷ 6 = 2/3
  2. b = y₁ − m·x₁ = 1 − 0.666667 × −2 = 7/3
  3. θ = arctan(0.666667) = 33.6901°
  4. d = √(6² + 4²) = √52 = 7.211103
  5. Midpoint = ((−2 + 4) ÷ 2, (1 + 5) ÷ 2) = (1, 3)

Working out a roof pitch? The roofing calculator turns pitch into roof area. For percentages such as grade, see the percentage calculator.

How to use the Slope Calculator

  1. 1Enter the coordinates of two points, (x₁, y₁) and (x₂, y₂). Decimals and negative numbers are fine.
  2. 2Read the slope as a fraction and a decimal, with rise over run, angle and grade.
  3. 3Copy the equation of the line in slope-intercept, point-slope or standard form.
  4. 4To find a second point instead, choose Point + slope + distance and enter a slope or angle and a distance.

The slope formula

The slope of a line tells you how steep it is and which way it goes. It is the change in y (the rise) divided by the change in x (the run) between any two points on the line.

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

A positive slope climbs from left to right, a negative slope falls, a slope of 0 is a flat (horizontal) line, and a vertical line has an undefined slope because its run is zero.

Once you know the slope, the calculator works out everything else about the line:

Angle θ = arctan(m) · Grade = m × 100%
Distance = √((x₂ − x₁)² + (y₂ − y₁)²) · Midpoint = ((x₁ + x₂) ÷ 2, (y₁ + y₂) ÷ 2)
y-intercept b = y₁ − m × x₁, so the line is y = mx + b

The slope is shown as an exact fraction when the inputs allow it. Decimal coordinates are converted exactly, so points such as (0.1, 0.1) and (0.4, 0.2) give a slope of 1/3 rather than 0.333333.

Worked examples

Example 1: a positive slope. Points (−2, 1) and (4, 5).

  • Rise = 5 − 1 = 4. Run = 4 − (−2) = 6. Slope m = 4 ÷ 6 = 2/3 (about 0.6667).
  • b = 1 − (2/3)(−2) = 1 + 4/3 = 7/3, so the line is y = (2/3)x + 7/3.
  • Angle = arctan(2/3) ≈ 33.69°. Distance = √(6² + 4²) = √52 ≈ 7.211. Midpoint = (1, 3).
  • Standard form, with whole numbers: 2x − 3y = −7.

Example 2: a negative slope. Points (1, 4) and (3, 0).

  • m = (0 − 4) ÷ (3 − 1) = −4 ÷ 2 = −2.
  • b = 4 − (−2)(1) = 6, so y = −2x + 6. The line crosses the x-axis at x = 3.
  • Angle = arctan(−2) ≈ −63.43°, which is the same as 116.57° measured anticlockwise from the positive x-axis.

Example 3: a wheelchair ramp. A ramp rises 0.5 m over a horizontal run of 6 m.

  • m = 0.5 ÷ 6 ≈ 0.0833, a grade of 8.33% and an angle of about 4.76°.
  • That is a 1:12 ratio, the steepest running slope the US 2010 ADA Standards allow for a ramp.

Example 4: finding a second point. Start at (0, 0) and move 5 units along a line with slope 3/4. The run is 5 ÷ √(1 + 0.75²) = 4 and the rise is 0.75 × 4 = 3, so the new point is (4, 3), or (−4, −3) in the other direction. Choose Point + slope + distance to do this with any slope or angle.

Slope, angle and grade compared

People describe steepness in different ways. Maths classes use slope, surveyors and road signs use grade, and builders often use an angle or a ratio. This table converts between them.

Slope (m) Ratio Grade Angle
0.05 1 : 20 5% 2.86°
0.0833 1 : 12 8.33% 4.76°
0.1 1 : 10 10% 5.71°
0.25 1 : 4 25% 14.04°
0.3333 1 : 3 33.3% 18.43°
0.5 1 : 2 50% 26.57°
1 1 : 1 100% 45°
2 2 : 1 200% 63.43°
10 10 : 1 1,000% 84.29°

Notice that a 100% grade is only 45°, not vertical. A vertical line would have an infinite grade.

Three ways to write the equation

The calculator gives the same line in three common forms:

Form Pattern Example 1 line
Slope-intercept y = mx + b y = (2/3)x + 7/3
Point-slope y − y₁ = m(x − x₁) y − 1 = (2/3)(x + 2)
Standard Ax + By = C 2x − 3y = −7

Slope-intercept form is the easiest to graph. Point-slope form is quickest to write when you already know a point and the slope. Standard form uses whole numbers, which many textbooks prefer for final answers.

Tips and common mistakes

  • Keep the order the same. If you subtract y₁ from y₂ on top, subtract x₁ from x₂ underneath. Mixing the order flips the sign of the answer.
  • Watch double negatives. 4 − (−2) is 6, not 2. Writing the brackets in helps.
  • Simplify fractions. 4/6 and 2/3 are the same slope; the calculator always reduces.
  • Undefined is not zero. A vertical line (same x for both points) has no slope, while a horizontal line (same y) has a slope of 0.
  • Parallel and perpendicular lines. Parallel lines have equal slopes. Perpendicular lines have slopes that multiply to −1, so a line perpendicular to slope 2/3 has slope −3/2.

Roof pitch is a slope too: a 6/12 pitch is a slope of 0.5. The roofing calculator turns pitch into roof area. For the area of shapes between lines, use the area calculator. If your slope is a messy fraction, the fraction calculator can simplify or combine it, and the scientific calculator handles arctan and square roots directly.

Cite this calculator

Using this calculator in an essay, report or article? Copy a ready-made reference. Check your teacher's or publisher's style guide for small differences.

APA
KazamTools. (2026, October 27). Slope calculator. Retrieved October 30, 2026, from https://kazamtools.com/math/slope-calculator/
MLA
"Slope Calculator." KazamTools, 27 Oct. 2026, https://kazamtools.com/math/slope-calculator/. Accessed 30 Oct. 2026.
Chicago
KazamTools. "Slope Calculator." Last modified October 27, 2026. Accessed October 30, 2026. https://kazamtools.com/math/slope-calculator/.
Plain link
Slope Calculator (KazamTools): https://kazamtools.com/math/slope-calculator/
HTML link
<a href="https://kazamtools.com/math/slope-calculator/">Slope calculator</a> by KazamTools

Frequently asked questions

How do you find the slope from two points?

Subtract the y-values and divide by the difference of the x-values: m = (y₂ − y₁) ÷ (x₂ − x₁). For (−2, 1) and (4, 5) that is 4 ÷ 6 = 2/3.

What does a negative slope mean?

The line goes down as you move to the right. A slope of −2 means y falls by 2 for every 1 step to the right.

What is the slope of a vertical line?

It is undefined, because the run (x₂ − x₁) is zero and you cannot divide by zero. The equation of a vertical line is simply x = a number. A horizontal line has slope 0.

How do I turn a slope into an angle?

Take the inverse tangent: θ = arctan(m). A slope of 1 is 45°, a slope of 0.5 is about 26.57° and a slope of 2 is about 63.43°.

What is the difference between slope and grade?

Grade is the slope written as a percentage, used for roads and ramps. A slope of 0.08 is an 8% grade: the road rises 8 m for every 100 m across.

Does it matter which point I call point 1?

No. Swapping the points flips the sign of both the rise and the run, so the slope stays the same. Only the working changes.

What is y = mx + b?

The slope-intercept form of a straight line. m is the slope and b is where the line crosses the y-axis. Once you know m, b = y₁ − m × x₁.

Was this tool helpful?

Add this slope calculator to your website (free)

Copy this code into any web page. The tool stays free, has no ads inside it, and works on phones. Please keep the credit link under it.

Want a live preview or light and dark colours? Open this widget in the widget builder, where you can also browse every free calculator widget.