Free, with every step shown

Slope Calculator: Slope from Two Points

Type two points and get the slope, the line equation, the angle, the distance and the midpoint. Through (1, 2) and (4, 8) the slope is m = 6 ÷ 3 = 2 and the line is y = 2x.

Fractions stay exact (m = −2/3, not −0.6667), and vertical lines are detected.

Find the slope from two points

Whole numbers, decimals, negatives and fractions (3/4) work. Results update as you type.

Point 1 (x₁, y₁)

Point 2 (x₂, y₂)

m = 2

Slope-intercept form
y = 2x
Point-slope form
y − 2 = 2(x − 1)
y-intercept
0
Angle with the x-axis
63.4349°
Distance between the points
3√5 ≈ 6.7082
Midpoint
(2.5, 5)
  1. Slope m = (y₂ − y₁) ÷ (x₂ − x₁)
  2. Δy = 8 − 2 = 6; Δx = 4 − 1 = 3
  3. m = 6 ÷ 3 = 2 (line rises left to right)
  4. y-intercept: b = y₁ − m·x₁ = 2 − 2·1 = 0, so y = 2x
  5. Distance = √((Δx)² + (Δy)²) = √(3² + 6²) = √45 = 3√5 ≈ 6.7082
Explain the steps with AI

Worked examples

Example 1: Slope through (−2, 3) and (4, −1)

Find m and the line.

  1. Δy = −1 − 3 = −4; Δx = 4 − (−2) = 6
  2. m = −4 ÷ 6 = −2/3
  3. b = 3 − (−2/3)(−2) = 3 − 4/3 = 5/3

m = −2/3, line y = −(2/3)x + 5/3.

Example 2: Vertical line through (2, 1) and (2, 5)

Both points have x = 2.

  1. Δx = 2 − 2 = 0
  2. m = 4 ÷ 0 is undefined

The slope is undefined; the line is x = 2.

Example 3: Distance from (0, 0) to (3, 4)

Use the distance formula.

  1. Δx = 3, Δy = 4
  2. √(3² + 4²) = √25 = 5

Distance 5, slope 4/3, midpoint (1.5, 2).

Stuck on a step, or have a word problem?

Press Explain the steps with AI under any answer and the MathAI GPT math solver opens with your numbers already filled in, then explains the method line by line and answers follow-up questions. You can also type or photograph the whole question. On your phone, use MathAI GPT for iPhone or MathAI GPT for Android.

Slope calculator FAQ

How do I find the slope between two points?

Use m = (y₂ − y₁) ÷ (x₂ − x₁). For (1, 2) and (4, 8): m = (8 − 2) ÷ (4 − 1) = 6 ÷ 3 = 2. It does not matter which point you call first, as long as you use the same order on top and bottom.

How do I write the equation of the line?

Find the slope m, then the y-intercept b = y₁ − m·x₁, and write y = mx + b. For (−2, 3) and (4, −1): m = −4/6 = −2/3 and b = 3 − (−2/3)(−2) = 5/3, so y = −(2/3)x + 5/3.

What does a slope of 0 or an undefined slope mean?

A slope of 0 is a horizontal line (y never changes). An undefined slope happens when x₂ = x₁: the line is vertical, its equation is x = constant, and you would be dividing by zero.

What does a negative slope mean?

The line falls from left to right: y decreases as x increases. A slope of −2 means y drops 2 units for every 1 unit to the right.

How is slope related to the angle of a line?

The slope is the tangent of the angle the line makes with the x-axis: angle = arctan(m). A slope of 1 is 45°, and a slope of 2 is about 63.43°.

How do I find the distance and midpoint of two points?

Distance = √((x₂ − x₁)² + (y₂ − y₁)²) and midpoint = ((x₁ + x₂)/2, (y₁ + y₂)/2). For (0, 0) and (3, 4) the distance is √25 = 5 and the midpoint is (1.5, 2).

Related calculators