Skip to content

Slope Calculator

First point
Second point
Slope (m) —
Slope as rise/run
—
Line equation
—
y-intercept (b)
—
Angle to the x-axis (°)
—
Grade
—
Distance between points
—
Direction
—

Slope is rise over run: m = (y₂ − y₁) ÷ (x₂ − x₁). For the points (1, 2) and (3, 8), the rise is 6 and the run is 2, so the slope is 3. The line through them is y = 3x − 1, it climbs at about 71.57° to the x-axis, and the points are 6.3246 units apart.

About this tool

Students checking homework, teachers preparing answer keys and anyone reading a gradient off a graph need the same thing: the slope between two known points. Enter the coordinates of two points and the calculator returns the slope as a decimal and as a reduced fraction, the slope-intercept equation y = mx + b, the angle the line makes with the x-axis, the grade as a percentage and the straight-line distance between the points. The working is listed line by line so you can compare it with your own. One limit: when both points share the same x value the line is vertical and has no defined slope, so the calculator reports that instead of a number.

How to use it

  1. Enter the first point

    Type x₁ and y₁ in the First point group. Negative values and decimals are fine.

  2. Enter the second point

    Type x₂ and y₂. The order of the two points does not change the slope.

  3. Read the slope and the line

    The slope, its fraction form, the equation, angle, grade and distance update as you type.

  4. Check the working

    The listed steps show the rise, the run, the division and the intercept calculation.

Examples

(1, 2) to (3, 8)

x₁
1
y₁
2
x₂
3
y₂
8

Result Slope (m): 3
Slope as rise/run: 3
Line equation: y = 3x − 1
y-intercept (b): -1
Angle to the x-axis (°): 71.57
Grade: 300%
Distance between points: 6.3246
Direction: Rising (positive slope)

  1. Rise = y2 − y1 = 8 − 2 = 6
  2. Run = x2 − x1 = 3 − 1 = 2
  3. Slope m = rise ÷ run = 6 ÷ 2 = 3
  4. Intercept b = y1 − m·x1 = 2 − 3 × 1 = -1
  5. Angle = arctan(3) = 71.57°
  6. Distance = √(2² + 6²) = 6.3246

The line rises 6 units over a run of 2, so every step of 1 in x adds 3 to y and the line crosses the y-axis at −1.

(−2, 5) to (4, 1)

x₁
-2
y₁
5
x₂
4
y₂
1

Result Slope (m): -0.6667
Slope as rise/run: -2/3
Line equation: y = -0.6667x + 3.6667
y-intercept (b): 3.6667
Angle to the x-axis (°): -33.69
Grade: -66.67%
Distance between points: 7.2111
Direction: Falling (negative slope)

  1. Rise = y2 − y1 = 1 − 5 = -4
  2. Run = x2 − x1 = 4 − -2 = 6
  3. Slope m = rise ÷ run = -4 ÷ 6 = -0.6667
  4. Intercept b = y1 − m·x1 = 5 − -0.6667 × -2 = 3.6667
  5. Angle = arctan(-0.6667) = -33.69°
  6. Distance = √(6² + -4²) = 7.2111

A drop of 4 over a run of 6 reduces to −2/3, so the line falls about 0.667 for each unit to the right.

(1, 4) to (7, 4)

x₁
1
y₁
4
x₂
7
y₂
4

Result Slope (m): 0
Slope as rise/run: 0
Line equation: y = 4
y-intercept (b): 4
Angle to the x-axis (°): 0
Grade: 0%
Distance between points: 6
Direction: Horizontal (zero slope)

  1. Rise = y2 − y1 = 4 − 4 = 0
  2. Run = x2 − x1 = 7 − 1 = 6
  3. Slope m = rise ÷ run = 0 ÷ 6 = 0
  4. Intercept b = y1 − m·x1 = 4 − 0 × 1 = 4
  5. Angle = arctan(0) = 0°
  6. Distance = √(6² + 0²) = 6

Both points share y = 4, so the rise is zero and the line is flat.

How it is calculated

m = (y₂ − y₁) / (x₂ − x₁); b = y₁ − m·x₁; θ = arctan(m)

m
slope, the change in y per unit change in x
b
y-intercept, where the line crosses the y-axis
θ
angle between the line and the positive x-axis, in degrees
(x₁, y₁), (x₂, y₂)
the two points on the line

The rise (difference in y) is divided by the run (difference in x). When both differences are whole numbers they are divided by their greatest common divisor to give a reduced fraction. Substituting the first point into y = mx + b gives the intercept. The angle is the arctangent of the slope, grade is the slope times 100, and distance comes from the Pythagorean theorem applied to the run and rise.

When not to use it

  • Do not use it for a curve; the result is only the slope of the secant line between the two points.
  • It cannot describe a vertical line, whose slope is undefined.
  • For a best-fit slope through many data points, use a linear regression tool instead.

Common mistakes

  • Subtracting y values in one order and x values in the other flips the sign of the slope.
  • Reading grade as the angle confuses 100% grade with 45°, not 90°.
  • Swapping x and y coordinates gives the reciprocal of the true slope.

Frequently asked questions

Does it matter which point I enter first?

No. Swapping the points negates both the rise and the run, and the two signs cancel. (1, 2) to (3, 8) and (3, 8) to (1, 2) both give a slope of 3.

What does a negative slope mean?

The line falls as x increases. A slope of −2/3 means y drops by 2 for every 3 units moved to the right, and the angle to the x-axis is negative, about −33.69°.

Why is the slope of a vertical line undefined?

On a vertical line both points have the same x, so the run is zero and the division by zero has no value. The line is written x = constant instead of y = mx + b.

How is grade different from slope?

Grade is the slope expressed as a percentage, so a slope of 0.08 is an 8% grade, as on a road sign. A 100% grade is a slope of 1, which is a 45° angle, not a vertical wall.

How do I get the angle from the slope?

Take the arctangent: θ = arctan(m). A slope of 1 gives 45°, a slope of 3 gives about 71.57°, and a slope of 0 gives 0°. The result lies between −90° and 90°.

Why does the fraction show a decimal sometimes?

A reduced fraction is shown when both the rise and the run are whole numbers. With decimal coordinates such as 0.3 the ratio is shown as a decimal to six places instead.

Cite this tool

Using this tool in an assignment, article or report? Copy a citation, or a link for your website.

APA

Tools Directory Editorial Team. (2026, October 28). Slope Calculator. Tools Directory. Retrieved October 28, 2026, from https://tools.milunir.com/math/algebra-tools/slope-calculator/

MLA

Tools Directory Editorial Team. “Slope Calculator.” Tools Directory, 28 Oct. 2026, https://tools.milunir.com/math/algebra-tools/slope-calculator/. Accessed 28 Oct. 2026.

Chicago

Tools Directory Editorial Team. “Slope Calculator.” Tools Directory. Last modified October 28, 2026. Accessed October 28, 2026. https://tools.milunir.com/math/algebra-tools/slope-calculator/.

Link<a href="https://tools.milunir.com/math/algebra-tools/slope-calculator/">Slope Calculator – Tools Directory</a>