Slope calculator

Type the coordinates of two points and the calculator gives the slope of the line through them, its angle, the distance between the points, the midpoint and the equation of the line. Vertical lines are handled too.

Slope m2
Line equationy = 2x − 1
Angle with the x-axis
63.4349°
Distance between the points
6.708204
Midpoint (x; y)
(2.5; 4)
Rise / run
6 / 3
Slope as a percentage
200%

Steps

  1. Slope m = (y₂ − y₁) ÷ (x₂ − x₁) = (7 − 1) ÷ (4 − 1) = 6 ÷ 3 = 2.
  2. Intercept b = y₁ − m · x₁ = 1 − 2 · 1 = −1, so the line is y = 2x − 1.
  3. Distance = √(dx² + dy²) = √((3)² + (6)²) = 6.708204.

Runs in your browser: nothing you enter is sent anywhere.

How to use it

  1. Enter the coordinates of the first point (x₁, y₁) and the second point (x₂, y₂).
  2. The slope, equation, angle, distance and midpoint appear at once.
  3. The steps below show how each value was found.

Formulas

Value Formula
Slope m = (y₂ − y₁) ÷ (x₂ − x₁)
Intercept b = y₁ − m × x₁
Angle arctan(m), in degrees
Distance √((x₂ − x₁)² + (y₂ − y₁)²)
Midpoint ((x₁ + x₂) ÷ 2, (y₁ + y₂) ÷ 2)
Percent grade m × 100

Worked examples

  • (1, 1) and (4, 7). m = 6 ÷ 3 = 2, b = −1, so the line is y = 2x − 1. The distance is √45 ≈ 6.708, the midpoint is (2.5; 4) and the angle is 63.43°.
  • (3, 1) and (3, 5). The line is vertical, x = 3, and the slope has no value.
  • (0, 2) and (5, 2). The slope is 0 and the line is y = 2.

Common mistakes

  • Swapping the order of subtraction in only one of the two differences. Use the same point first in both and the sign comes out right.
  • Reading the slope as an angle. A slope of 1 is 45°, not 1°; use the angle shown for that.

Frequently asked questions

How do I calculate the slope between two points?

Divide the change in y by the change in x, m = (y₂ − y₁) ÷ (x₂ − x₁). For (1, 1) and (4, 7) the slope is 6 ÷ 3 = 2.

What is the slope of a vertical line?

It has no value, because the change in x is 0 and you cannot divide by zero. A vertical line has the equation x = c, and the calculator shows its angle as 90°.

What does a slope of zero or a negative slope mean?

A slope of 0 is a horizontal line. A positive slope rises from left to right and a negative slope falls. The angle with the x-axis is arctan(m), between −90° and 90°.

How is the line equation y = mx + b found?

First get the slope m, then the intercept b = y₁ − m × x₁. With m = 2 and the point (1, 1), b = 1 − 2 = −1, so the line is y = 2x − 1.

More in Math

All tools in this category: Math ·Updated November 3, 2026

Privacy choices

Google Analytics shows us which tools are used and whether they work. It may set cookies. Your choice is kept in this browser.