Slope Calculator

Calculate slope, y-intercept, line equation, distance, and midpoint from two coordinate points.

Line Equation

y = 2x

Slope (m)2.000000
Y-intercept (b)0.000000
Distance6.708204
Angle63.43°
Midpoint(1.5, 3)
Rise / Run6 / 3

How to Use the Slope Calculator

  1. Enter Point 1 as (x1, y1). The default is (0, 0).
  2. Enter Point 2 as (x2, y2). The default is (3, 6).
  3. Read the results. You get the slope, y-intercept, the full line equation in slope-intercept form (y = mx + b), the distance between the two points, the angle of the line in degrees, and the midpoint.

If both x-values are identical, the line is vertical and slope is undefined. Negative slope means the line goes down from left to right. Slope of 0 means a horizontal line.

Slope Formulas

Slope:          m = (y2 - y1) / (x2 - x1)
Y-intercept:    b = y1 - m × x1
Line equation:  y = mx + b

Distance:       d = √[(x2 - x1)² + (y2 - y1)²]
Midpoint:       M = ((x1 + x2)/2, (y1 + y2)/2)
Angle:          θ = arctan(m) in degrees

Example with Point 1 = (0, 0) and Point 2 = (3, 6):
  m = (6 - 0) / (3 - 0) = 6 / 3 = 2
  b = 0 - 2×0 = 0
  Equation: y = 2x
  Distance: √(3² + 6²) = √(9 + 36) = √45 ≈ 6.708
  Midpoint: (1.5, 3)
  Angle: arctan(2) ≈ 63.43°

Frequently Asked Questions

Divide the change in y (rise) by the change in x (run). Formula: m = (y2 - y1) / (x2 - x1). For points (1, 3) and (4, 9): rise = 9 - 3 = 6, run = 4 - 1 = 3, slope = 6/3 = 2. A slope of 2 means for every 1 unit you move right, the line goes up 2 units.

Related Calculators