SahlCalc سهل
Gulf Hubs:

Saudi Arabia: Labour: HRSD · Tax and zakat: ZATCA

Slope Calculator

Enter two points to get the slope of the line through them, its equation in slope-intercept form, the angle it makes with the x-axis and the distance between the points.

x-coordinate of the first point, e.g. 2 for (2, 3)

y-coordinate of the first point, e.g. 3 for (2, 3)

x-coordinate of the second point, e.g. 6 for (6, 11)

y-coordinate of the second point, e.g. 11 for (6, 11)

Slope m

2

Equation

y = 2x − 1

y-intercept b

-1

Angle

63.4349°

Distance

8.94427191

A positive slope rises from left to right.

Formula with your numbers

  • Slope m = (y₂ − y₁) ÷ (x₂ − x₁) = (11 − 3) ÷ (6 − 2) = 8 ÷ 4 = 2
  • Intercept b = y₁ − m·x₁ = 3 − 2 × 2 = -1
  • Angle θ = atan(2) = 63.4349°
  • Distance d = √(4² + 8²) = 8.94427191

Quick answer: For the points (2, 3) and (6, 11) the slope is (11 − 3) ÷ (6 − 2) = 8 ÷ 4 = 2, the intercept is 3 − 2 × 2 = −1, so the line is y = 2x − 1.

How it's calculated

Slope is rise over run: m = (y₂ − y₁) ÷ (x₂ − x₁). It tells you how much y changes for each step of 1 in x.

With the slope known, the y-intercept is b = y₁ − m·x₁, which gives the slope-intercept form y = mx + b. The angle of the line is θ = atan(m), measured from the positive x-axis between −90° and 90° (a falling line has a negative angle; some calculators add 360° and report it as a direction from 0° to 360°, e.g. −42.27° as 317.73°). The distance between the points comes from the Pythagorean theorem, √(Δx² + Δy²).

If x₁ = x₂ the run is zero, the slope is undefined and the line is vertical, with equation x = x₁. A slope of 0 is a horizontal line.

Worked examples

  • (2, 3) and (6, 11): m = 8 ÷ 4 = 2, y = 2x − 1, θ = 63.4349°
  • (0, 5) and (4, 3): m = −2 ÷ 4 = −0.5, y = −0.5x + 5
  • (3, 1) and (3, 7): run = 0 → vertical line x = 3

Frequently asked questions

What is the slope formula?

m = (y₂ − y₁) ÷ (x₂ − x₁): the change in y divided by the change in x between two points on the line.

Does the order of the points matter?

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

How do I turn slope into a percentage grade?

Multiply the slope by 100. A slope of 0.08 is an 8% grade, as used for roads and ramps.

How do I find the distance only?

Use the distance calculator, which also handles 3D points and the midpoint.

What does a negative slope mean?

The line goes downhill from left to right. A slope of −2 means y drops by 2 every time x goes up by 1.

What are the slopes of parallel and perpendicular lines?

Parallel lines share the same slope. Perpendicular ones multiply to −1, so a line at right angles to a slope of 2 has a slope of −½.