Distance Calculator

Calculate the distance between any two points using the coordinate distance formula.

Distance Calculator

d = √((x₂-x₁)² + (y₂-y₁)²)

Point 1

Point 2

Distance

5

units

Midpoint X

1.5

Midpoint Y

2

Slope (m)

1.3333

d = √(9 + 16) = 5

Distance Calculator Formula & How It Works

d = √[(x₂−x₁)² + (y₂−y₁)²] (2D) | d = √[(Δx)²+(Δy)²+(Δz)²] (3D)
  • 2D: distance between (x₁,y₁) and (x₂,y₂)
  • 3D: distance between (x₁,y₁,z₁) and (x₂,y₂,z₂)
  • Midpoint: ((x₁+x₂)/2, (y₁+y₂)/2)
  • Manhattan distance: |x₂−x₁| + |y₂−y₁| (city block distance)

The distance formula is the Pythagorean theorem applied to coordinate geometry. The horizontal and vertical differences form the two legs of a right triangle; the hypotenuse is the distance. Widely used in computer graphics, game development, machine learning (nearest neighbor), and navigation.

Distance Calculator FAQs

How do you calculate distance between two GPS coordinates?

GPS coordinates are latitude/longitude on a sphere — use the Haversine formula: a = sin²(Δlat/2) + cos(lat₁)×cos(lat₂)×sin²(Δlon/2); d = 2R×arcsin(√a). For short distances (<100 km), the flat-earth approximation is close enough.

What is Manhattan distance vs Euclidean distance?

Euclidean (straight-line): d = √(Δx²+Δy²). Manhattan (grid): d = |Δx|+|Δy|. Euclidean measures as the crow flies; Manhattan measures actual walking distance on a rectangular grid. Used in machine learning for different nearest-neighbor problems.

Related Calculators