CalcArcade.

Slope, Distance and Midpoint Calculator

Enter the coordinates of two points. The calculator gives the slope of the line through them, the distance between them, their midpoint, the equation of the line and its angle with the x-axis.

Your numbers

Result

How we calculate it

With dx = x2 − x1 and dy = y2 − y1, the slope is dy ÷ dx, the distance is √(dx² + dy²) and the midpoint is ((x1 + x2) ÷ 2, (y1 + y2) ÷ 2). The line is y = m × x + b, where m is the slope and b = y1 − m × x1.

A vertical line has dx = 0, so its slope is undefined and its equation is x = a number. The angle is measured from the positive x-axis, from 0° up to 180°. For (1, 2) and (4, 6) the slope is 1.3333, the distance is 5, the midpoint is (2.5, 4) and the line is y = 1.3333x + 0.6667.

Assumptions and limits

  • The written line equation is rounded to 4 decimal places.
  • The two points must be different.
  • Coordinates can be negative or decimals.

Frequently asked questions

How do I find the slope between two points?

Divide the change in y by the change in x. From (1, 2) to (4, 6), y changes by 4 and x by 3, so the slope is 4 ÷ 3.

What is the slope of a vertical line?

It is undefined, because the change in x is zero and you cannot divide by zero. The line is written as x equals a constant.

How do I find the midpoint?

Average the x values and average the y values. The midpoint of (1, 2) and (4, 6) is (2.5, 4).

Related calculators

Worked example (a fixed example using the starting numbers, it does not change as you type)

Inputs: Point 1: x = 1; Point 1: y = 2; Point 2: x = 4; Point 2: y = 6.

  • Slope 1.3333
  • Distance 5
  • Midpoint (2.5, 4)
  • Line equation y = 1.3333x + 0.6667
  • Angle with the x-axis 53.13 degrees
  • Change in x 3
  • Change in y 4

Embed this calculator

Add this calculator to your own page. Paste the code where you want it. The small link keeps credit to the source.

More math calculators

Last reviewed: . Formulas and assumptions are described on our methodology page. For information only; not professional advice.