Coordinate geometry calculator

Distance, midpoint and slope between two points on a coordinate plane.

Enter your values and press Calculate. Your inputs stay in the address, so you can switch language or share the link.

Formula

distance = √((x₂−x₁)² + (y₂−y₁)²) midpoint = ((x₁+x₂)/2, (y₁+y₂)/2) slope = (y₂−y₁) ÷ (x₂−x₁)

How it works

Distance uses the Pythagorean theorem on the horizontal and vertical gaps between the points. The midpoint averages the x-coordinates and the y-coordinates separately. The slope is the vertical change divided by the horizontal change; it is undefined for a vertical line.

Worked example

The same calculation with the default values:

  • x₁ 1
  • y₁ 2
  • x₂ 7
  • y₂ 10
  1. distance = √((7 − 1)² + (10 − 2)²) = 10
  2. midpoint = ((1 + 7) ÷ 2, (2 + 10) ÷ 2)
  3. slope = (10 − 2) ÷ (7 − 1) = 1.333333

Result: Distance: 10 · Midpoint x: 4 · Midpoint y: 6

The slope formula is undefined for a perfectly vertical line (when x₂ = x₁) - this is a genuine mathematical limitation, not a calculator error, and reflects that a vertical line has no well-defined finite slope.

Common mistakes

  • Subtracting coordinates in the wrong order inconsistently between x and y (e.g. x₂−x₁ but y₁−y₂) - the order must be consistent in both the distance and slope formulas, though the distance formula's squaring hides this particular mistake while the slope formula does not.
  • Confusing midpoint with distance - the midpoint is a point (an x,y location halfway between), not a length; they answer different questions and use different formulas.
  • Treating a vertical line's undefined slope as zero - a slope of zero describes a horizontal line, the opposite case; a vertical line's slope is undefined, not zero.

Related calculators