Home/Math/Chebyshev Distance Calculator
Math

Chebyshev Distance Calculator

x
y
x
y
About this tool

King moves, L∞ norm & maximum absolute difference

The Chebyshev Distance Calculator computes the maximum absolute difference across all coordinate axes — the L∞ (L-infinity) norm. It answers the question: "what is the largest single-axis gap between these two points?"

Chebyshev distance is best known as the chessboard distance: it counts the minimum number of moves a king needs to travel between two squares on a chess board. A king can move diagonally, so it covers both axes simultaneously — the bottleneck is always the larger of the two differences.

Key applications:

  • Game development — A* pathfinding with diagonal movement, tile-based maps where diagonal moves are allowed.
  • Warehouse robotics — cranes that move simultaneously on X and Y axes.
  • Machine learning — feature comparison where only the worst-case dimension matters.
  • Generalised distance — it is Minkowski distance as p→∞.

Example

Chess example: King at d4 (file 4, rank 4), moving to g7 (file 7, rank 7).

|7−4| = 3 (files), |7−4| = 3 (ranks). max(3, 3) = 3 moves. The king moves diagonally 3 times — it handles both axes at once.

Compare: Manhattan distance = 6 (can't go diagonally). Euclidean distance = √18 ≈ 4.24 (straight line through the board).

FAQ

Frequently Asked Questions

What is Chebyshev distance?

Chebyshev distance is the maximum absolute difference between the coordinates of two points across all dimensions: max(|a₁−b₁|, |a₂−b₂|, …). It is also called L∞ (L-infinity) distance or chessboard distance. It represents the minimum number of moves a chess king needs to travel between two squares.

What is the formula for Chebyshev distance?

d(A, B) = max(|a₁−b₁|, |a₂−b₂|, …, |aₙ−bₙ|). In 2D: max(|x₂−x₁|, |y₂−y₁|). Example: A=(1,3) and B=(4,6): max(|4−1|, |6−3|) = max(3,3) = 3.

Why is Chebyshev distance called chessboard distance?

A chess king can move one step in any of 8 directions — including diagonals. This means in one move it can decrease both the row and column distance by 1. The total number of moves needed is therefore the maximum of the absolute row and column differences, not the sum — which is exactly the Chebyshev formula. On a standard 8×8 board, the maximum Chebyshev distance is 7.

How is Chebyshev distance used in game development?

In tile-based games with diagonal movement allowed, Chebyshev distance gives the optimal move count for any agent that can move in 8 directions (like a chess king). A* pathfinding algorithms use it as an admissible heuristic when diagonal movement costs the same as cardinal movement. It is also used in real-time strategy games for area-of-effect range calculations.

What is the difference between Chebyshev, Manhattan, and Euclidean distance?

For the same two points, Chebyshev ≤ Euclidean ≤ Manhattan (always). Chebyshev = max axis difference (diagonal movement allowed). Euclidean = straight-line distance (any angle allowed). Manhattan = sum of axis differences (no diagonal movement). Use our Euclidean and Manhattan calculators to compare all three.

What is L∞ norm?

The L∞ norm (L-infinity norm) of a vector is its maximum absolute component: ‖v‖∞ = max(|v₁|, |v₂|, …). Chebyshev distance is the L∞ norm of the difference vector (A−B). As p→∞ in the Minkowski distance formula, the result converges to the L∞ norm, making Chebyshev a limiting case of Minkowski distance.

How does Chebyshev distance relate to Minkowski distance?

Chebyshev distance is the limiting case of Minkowski distance as p approaches infinity. The Minkowski formula (Σ|aᵢ−bᵢ|ᵖ)^(1/p) converges to max(|aᵢ−bᵢ|) as p→∞ because the largest term dominates the sum. At p=1 it equals Manhattan, at p=2 it equals Euclidean, at p=∞ it equals Chebyshev.

Is Chebyshev distance used in machine learning?

Yes, but less commonly than Euclidean or Manhattan. It appears in anomaly detection (where the worst-case feature deviation matters), some clustering algorithms, and specific kNN implementations. It's also used in image processing for morphological operations. Chebyshev distance is particularly useful when the limiting (maximum) dimension determines the outcome rather than the aggregate.