The short answer
The right distance formula depends on how you're allowed to travel between two points. Straight-line ("as the crow flies") distance uses the Euclidean formula, d = √[(x₂−x₁)² + (y₂−y₁)²]. Grid-based movement, like city blocks, uses Manhattan distance instead: d = |x₂−x₁| + |y₂−y₁|. For places on Earth, geographic distance accounts for the planet's curvature using the Haversine formula.
Key takeaways
- Euclidean distance is always the shortest possible path between two points; Manhattan distance is always equal to or longer, since it can't cut diagonally.
- Euclidean and Manhattan distance are only equal when the two points share an x or y coordinate — movement along a single axis.
- Minkowski distance is a generalization: p = 1 gives Manhattan, p = 2 gives Euclidean, and p = ∞ gives Chebyshev distance (the largest single-axis difference).
- Geographic distance between coordinates needs the Haversine formula, not the flat-plane distance formula, because Earth's surface is curved.
Choosing the right distance formula
| Scenario | Formula | Why |
|---|---|---|
| Straight-line distance on a plane | Euclidean | Shortest possible path |
| Distance along city blocks / a grid | Manhattan | Can't cut diagonally through blocks |
| Distance between two Earth coordinates | Geographic (Haversine) | Accounts for the planet's curvature |
| General, tunable distance metric | Minkowski | Family covering Euclidean, Manhattan & Chebyshev |
Worked example: three distances, one pair of points
Take the points (0, 0) and (3, 4). Depending on the metric, "the distance" between them isn't a single number:
| Metric | Calculation | Result |
|---|---|---|
| Euclidean (p=2) | √(3² + 4²) = √25 | 5 |
| Manhattan (p=1) | |3| + |4| | 7 |
| Chebyshev (p=∞) | max(3, 4) | 4 |
All three answers are correct — for their own definition of "distance." Euclidean gives the shortest path (a straight line), Manhattan gives the longest (grid-only movement), and Chebyshev gives the shortest of all, since it only counts the larger of the two axis differences.
The Minkowski distance family
d = (Σ|xᵢ − yᵢ|ᵖ)^(1/p)
Minkowski distance is a single formula with a tunable parameter p. Setting p = 1 reduces it to Manhattan distance, p = 2 reduces it to Euclidean distance, and as p approaches infinity, it converges to Chebyshev distance — the largest single-axis gap between the two points. This makes Minkowski distance a useful way to sweep between "grid movement" and "straight-line movement" behavior for the same pair of points.
Common mistakes to avoid
- Using Euclidean distance to estimate real travel distance in a city grid — it underestimates actual walking or driving distance, which Manhattan distance models more realistically.
- Applying the flat-plane distance formula directly to latitude/longitude coordinates — a degree of longitude covers very different real-world distances depending on latitude, so this requires the Haversine formula instead.
- Using a Minkowski parameter p less than 1 and expecting normal distance behavior — below p = 1, the formula no longer satisfies the triangle inequality and stops behaving like a true distance metric.
- Worrying that negative coordinates will produce a negative distance — squaring (Euclidean) and absolute value (Manhattan) both remove sign, so distance is never negative and point order never matters.
Related calculators
- Pythagorean Theorem Calculator — see the right-triangle logic behind the 2D Euclidean distance formula.
- Right Triangle Calculator — solve for sides and angles in the triangle formed by your two points.
- Slope Calculator — find the steepness of the line connecting your two points.
- Triangle Calculator — work with three points and general triangle geometry.