Chebyshev Distance Calculator

Chebyshev distance4.00
Horizontal gap4.00
Vertical gap4.00
Manhattan distance8.00
How this was calculated
  1. The Chebyshev distance between two points is the larger of the horizontal and vertical gaps: d = max(|x2 - x1|, |y2 - y1|). It is the number of moves a chess king needs between the squares, which is why it is also called the chessboard distance.
  2. From (1, 2) to (5, 6): the horizontal gap is 4.00 and the vertical gap is 4.00.
  3. Chebyshev distance = max(4.00, 4.00) = 4.00.
  4. Because a king moves diagonally as easily as straight, the smaller gap is absorbed into the larger one - unlike the Manhattan distance, which adds both gaps together.

This Chebyshev distance calculator finds the Chebyshev distance between two points: the larger of the horizontal and vertical gaps, written as max(|x2 - x1|, |y2 - y1|). Enter the coordinates of two points and the calculator returns that single number. For example, from (1, 2) to (5, 4) the Chebyshev distance is 4.00. From (0, 0) to (3, 7) the vertical gap rules and the distance is 7.00. From (-2, -1) to (4, 3) the horizontal gap of 6.00 sets the distance.

The method is the accepted standard because it follows the definition of Chebyshev distance directly: compare the horizontal and vertical gaps and take the larger one, with no averaging or weighting in between. It is also called the chessboard distance, since it equals the number of moves a chess king needs between the two squares. This page shows the formula, step-by-step workings, worked examples and sources, so you can check each result by hand rather than trusting a black box. Whether you are working through a geometry problem, planning grid movement, or comparing distance measures, the calculator gives the same answer the definition does, and the workings show exactly where that answer comes from.

Worked examples

King moves, mostly horizontal

From (1, 2) to (5, 4) the Chebyshev distance is 4.00 - a king needs four moves. (1 · 2 · 5 · 6)

Chebyshev distance4.00
Horizontal gap4.00
Vertical gap4.00
Manhattan distance8.00

Vertical dominant

From (0, 0) to (3, 7) the vertical gap rules: 7.00. (0 · 0 · 3 · 7)

Chebyshev distance7.00
Horizontal gap3.00
Vertical gap7.00
Manhattan distance10.00

Diagonal pair

From (-2, -1) to (4, 3) the horizontal gap of 6.00 sets the distance. (-2 · 4 · 4 · -1)

Chebyshev distance6.00
Horizontal gap6.00
Vertical gap5.00
Manhattan distance11.00

What Chebyshev distance is

Chebyshev distance is the L-infinity metric: the distance between two points is set by whichever coordinate gap is larger. In two dimensions, you take the horizontal gap |x2 - x1| and the vertical gap |y2 - y1|, compare them, and keep the bigger one: max(|x2 - x1|, |y2 - y1|). The smaller gap is simply ignored. A chebyshev distance calculator applies this rule directly, so you never have to decide which gap matters — the larger one always wins.

A few examples make the rule concrete. From (1, 2) to (5, 4), the horizontal gap is 4 and the vertical gap is 2, so the Chebyshev distance is 4.00. From (0, 0) to (3, 7), the vertical gap rules and the distance is 7.00, even though the horizontal gap is only 3. From (-2, -1) to (4, 3), the horizontal gap of 6.00 sets the distance, while the vertical gap of 4 plays no part. In each case, one coordinate difference determines the answer and the other is overridden.

The chessboard picture is what makes this metric intuitive. Chebyshev distance is also called the chessboard distance because it equals the number of moves a chess king needs to travel between the two squares. A king can step one square in any direction — horizontally, vertically, or diagonally — so a diagonal step closes one unit of horizontal gap and one unit of vertical gap at the same time. That is why the larger gap controls the count: the king spends its moves shrinking both gaps together, and the longer gap is the one still unfinished when the shorter one runs out. Moving from a square 4 columns away and 2 rows away takes 4 king moves, matching the 4.00 distance above.

This contrasts with the straight-line, or Euclidean, distance, which combines both gaps and generally produces a smaller value than the larger gap alone. Chebyshev distance never exceeds the sum of the two gaps and is never less than either one. It is the natural measure when movement is allowed along diagonals at the same cost as straight steps — grid-based games, image processing on square pixels, and warehouse or storage layouts where a diagonal move counts as a single step.

Negative coordinates need no special handling: the absolute value in the formula treats a gap of -6 the same as a gap of 6, which is why the pair from (-2, -1) to (4, 3) gives 6.00. To use the formula by hand, subtract the x-values and take the absolute value, do the same for the y-values, then report whichever result is larger. The result is always zero or positive, and it is zero only when the two points coincide.

Chebyshev distance = max(|x2 - x1|, |y2 - y1|). The single largest coordinate gap is the whole answer — the other gap never changes it.

How to calculate it

Calculating Chebyshev distance takes two subtractions and one comparison. For any two points, (x1, y1) and (x2, y2), find the horizontal gap by subtracting the x-coordinates and taking the absolute value, |x2 - x1|. Find the vertical gap the same way: |y2 - y1|. The Chebyshev distance is the larger of those two numbers: max(|x2 - x1|, |y2 - y1|). You never add the gaps together and you never square anything — the smaller gap simply drops out of the answer. A chebyshev distance calculator does exactly this, but walking the examples by hand shows why the result comes out the way it does.

Start with (1, 2) to (5, 4). The horizontal gap is |5 - 1| = 4. The vertical gap is |4 - 2| = 2. Comparing the two, 4 is larger than 2, so the Chebyshev distance is 4.00. The horizontal gap rules here, and the vertical difference of 2 does not change the answer. Notice that the straight-line distance between these points would be shorter than 4, but Chebyshev distance does not measure straight lines — it measures the largest single-axis gap, which is why the horizontal difference alone sets the result.

Now try (0, 0) to (3, 7). The horizontal gap is |3 - 0| = 3 and the vertical gap is |7 - 0| = 7. This time the vertical gap rules, and the distance is 7.00. The horizontal movement of 3 is irrelevant to the final number because it is smaller than 7. A third case shows the horizontal gap setting the distance: from (-2, -1) to (4, 3), the horizontal gap is |4 - (-2)| = 6 and the vertical gap is |3 - (-1)| = 4. The distance is 6.00, since the horizontal gap of 6.00 is the larger of the two. Negative coordinates are no trouble — subtracting a negative is the same as adding, and the absolute value keeps every gap positive.

The procedure is the same in every case, so you can follow it step by step:

The name chessboard distance explains the result. It equals the number of moves a chess king needs to travel between the two squares, because a king can move one square in any direction — including diagonally — on each move. Moving diagonally covers a horizontal and a vertical step at once, so the number of moves is set by whichever gap is larger. That is why the smaller gap never adds to the total: it gets absorbed into the diagonal moves.

  • Subtract the x-coordinates and take the absolute value to get the horizontal gap.
  • Subtract the y-coordinates and take the absolute value to get the vertical gap.
  • Keep the larger of the two gaps — that number is the Chebyshev distance.
  • Check with (1, 2) to (5, 4): gaps of 4 and 2 give 4.00.
  • Check with (0, 0) to (3, 7): gaps of 3 and 7 give 7.00.
  • Check with (-2, -1) to (4, 3): gaps of 6 and 4 give 6.00.
Quick rule: Chebyshev distance = max(horizontal gap, vertical gap). Only the bigger gap counts.

Chebyshev vs Manhattan vs Euclidean

Put the same two points into all three measures and the differences become concrete. Chebyshev distance keeps only the larger of the horizontal and vertical gaps: max(|x2 - x1|, |y2 - y1|). Manhattan distance adds the two gaps together. Euclidean distance takes the straight line between the points. A chebyshev distance calculator applies the first rule, but seeing all three side by side shows why the choice of measure matters.

Take the points (1, 2) and (5, 4). The horizontal gap is 4 and the vertical gap is 2, so the Chebyshev distance is 4.00, because the larger gap wins. Manhattan distance adds 4 and 2 for 6. Euclidean distance is the square root of 4 squared plus 2 squared, which is the square root of 20, about 4.47. Chebyshev and Euclidean land close together here because one gap clearly dominates; Manhattan sits higher because it counts both gaps in full.

Now move to (0, 0) and (3, 7). The vertical gap of 7 rules, so the Chebyshev distance is 7.00. Manhattan distance is 3 plus 7, or 10. Euclidean distance is the square root of 9 plus 49, the square root of 58, about 7.62. The pattern repeats: Chebyshev equals the biggest single gap, Manhattan equals the sum of the gaps, and Euclidean falls between them, closer to Chebyshev when one gap is much larger than the other.

A third pair shows the horizontal gap taking charge. From (-2, -1) to (4, 3), the horizontal gap is 6.00, and that sets the Chebyshev distance. The vertical gap is 4, so Manhattan distance is 6 plus 4, or 10, and Euclidean distance is the square root of 36 plus 16, the square root of 52, about 7.21. Whenever the gaps are unequal, Chebyshev simply ignores the smaller one, which is exactly why it is also called the chessboard distance: it equals the number of moves a chess king needs between the two squares.

In every case the three measures answer different questions. Chebyshev asks how far apart the points are along their worst axis, Manhattan asks how much total ground the gaps cover, and Euclidean asks for the straight-line separation. Run your own coordinates through the chebyshev distance calculator and compare the result with the other two to see which gap is driving the answer.

  • (1, 2) to (5, 4): Chebyshev 4.00, Manhattan 6, Euclidean about 4.47
  • (0, 0) to (3, 7): Chebyshev 7.00, Manhattan 10, Euclidean about 7.62
  • (-2, -1) to (4, 3): Chebyshev 6.00, Manhattan 10, Euclidean about 7.21
Chebyshev takes the larger gap, Manhattan adds both gaps, and Euclidean takes the straight line — so Chebyshev is never larger than Manhattan and never larger than Euclidean.

Where it is used

The Chebyshev distance between two points is the larger of the horizontal and vertical gaps: max(|x2 - x1|, |y2 - y1|). That single rule explains why the metric shows up wherever movement is measured in straight steps along two axes at once. A chebyshev distance calculator applies the rule directly, but knowing where the metric comes from helps you judge whether it is the right measure for a given problem.

In grid-based games, the Chebyshev distance is the natural way to count steps when a piece may move diagonally. It is also called the chessboard distance: it equals the number of moves a chess king needs between the two squares. The same logic carries over to tile-based maps, where a unit that can step in any of eight directions reaches a target in as many turns as the larger of its two coordinate gaps. From (1, 2) to (5, 4), for example, the Chebyshev distance is 4.00, so a king-like mover would need 4.00 moves — the horizontal gap of 4.00 being the larger of the two.

Warehouse and robotics motion with diagonal drives follows the same pattern. When a machine can travel along both axes simultaneously, the time or distance to a target is set by whichever axis has the longer run, not by the sum of the two. From (-2, -1) to (4, 3), the horizontal gap of 6.00 sets the distance, so a diagonal-capable mover is limited by that 6.00-unit span rather than by the shorter vertical gap. Checking which gap dominates is often the quickest way to plan a route or estimate travel time.

The metric also serves as the limit of the Minkowski family as p grows. Minkowski distance with parameter p blends the two coordinate gaps; as p increases, the larger gap increasingly dominates the result, and in the limit the measure becomes the Chebyshev distance. This makes it a useful reference point when comparing distance measures: if a problem is governed by the single largest coordinate difference, the Chebyshev value is the one to use.

A few worked checks show how the larger gap takes over. From (0, 0) to (3, 7), the vertical gap rules and the distance is 7.00, even though the horizontal gap is smaller. In each case the smaller gap drops out of the answer entirely, which is the defining behavior of the metric.

  • Grid-based games and chessboard-style movement, where a king needs as many moves as the larger coordinate gap.
  • Warehouse and robotics motion with diagonal drives, where the longer axis sets the travel span.
  • As the limit of the Minkowski family when p grows large, with the largest coordinate gap dominating.
Quick check: from (1, 2) to (5, 4) the Chebyshev distance is 4.00; from (0, 0) to (3, 7) the vertical gap rules and the distance is 7.00.

FAQs

What is Chebyshev distance?

Chebyshev distance is the larger of the horizontal and vertical gaps between two points. It is also called the L-infinity distance, and it equals the number of moves a chess king needs to travel between two squares on a board.

How do you calculate Chebyshev distance?

Take the absolute difference on each axis and keep the larger value: max(|x2 - x1|, |y2 - y1|). For example, from (1, 2) to (5, 4) the gaps are 4 and 2, so the Chebyshev distance is max(4, 2) = 4.00.

Why is it called chessboard distance?

A chess king moves one square in any direction, including diagonally, so its move count between two squares is exactly the Chebyshev distance. That direct link to king moves on a grid is why the measure is often called chessboard distance.

How does it differ from Manhattan distance?

Manhattan distance adds both gaps together, while Chebyshev distance keeps only the larger one. Because it keeps just the bigger gap instead of summing both, Chebyshev distance is always less than or equal to the Manhattan distance between the same two points.

Can Chebyshev distance be zero?

Yes, but only when the two points are identical. If there is any gap on either axis, even a small one, the larger gap is positive, so the Chebyshev distance becomes positive as well.

Where is Chebyshev distance used?

It appears in grid-based games, in motion planning for platforms that can move diagonally at full speed, and in image processing neighborhoods. In each case, counting the larger single-axis gap matches how movement or adjacency actually works on the grid.

Sources

Related calculators

Manhattan Distance Calculator
Manhattan (taxicab) distance between two points in 2D or 3D — the grid-route length — with the Euclidean distance alongside.
Distance Formula Calculator
Distance between two points on the coordinate plane, with the midpoint and both axis changes — Pythagoras, done for you.
Distance Between Two Points Calculator
The straight-line distance between two coordinate points, with the midpoint, the horizontal and vertical gaps, and the slope of the line through them.