Skip to content
FiftyCalc Free calculators for all 50 states

Manhattan Distance Calculator

Test cases replayed : 2 of 2 match · Methodology · No outside source listed

Enter two points. Leave z at 0 for points in the plane.

Result

Sample figures

Manhattan distance |Δx| + |Δy| + |Δz|—

Euclidean (straight-line) distance —

  • Chebyshev distance (largest single difference)—

Estimate for planning only, not tax, legal, financial or medical advice. This calculator uses the method explained on this page.

Manhattan Distance Calculator

Point 1: x: enter a number. Prefilled example: 1.

Point 1: y: enter a number. Prefilled example: 2.

Point 1: z (0 for 2D): enter a number. Prefilled example: 0.

Point 2: x: enter a number. Prefilled example: 4.

Point 2: y: enter a number. Prefilled example: 6.

Point 2: z (0 for 2D): enter a number. Prefilled example: 0.

How to use this calculator

Fill in the fields in this order; each step takes you to its field.

  1. Point 1: x: enter a number.
  2. Point 1: y: enter a number.
  3. Point 1: z (0 for 2D): enter a number.
  4. Point 2: x: enter a number.
  5. Point 2: y: enter a number.
  6. Point 2: z (0 for 2D): enter a number.
  7. Read the result: Manhattan distance |Δx| + |Δy| + |Δz|; the panel also shows Euclidean (straight-line) distance and Chebyshev distance (largest single difference).

How this calculator works

The Manhattan distance, also called taxicab or L1 distance, adds the absolute differences of the coordinates: d = |x₂ − x₁| + |y₂ − y₁| + |z₂ − z₁|. It is the length of a path that moves only along the grid, like a car on a city street plan.

For comparison, the Euclidean distance is the straight line √(Δx² + Δy² + Δz²) and the Chebyshev distance is the largest single difference. Manhattan ≥ Euclidean ≥ Chebyshev always holds.

The formula

  1. Man=|x2−x1|+|y2−y1|+|z2−z1|
Symbols used in the formula
SymbolMeaning
x1Point 1: x
y1Point 1: y
z1Point 1: z (0 for 2D)
x2Point 2: x
y2Point 2: y
z2Point 2: z (0 for 2D)
ManManhattan distance |Δx| + |Δy| + |Δz|

Worked example

Point 1: x1
Point 1: y2
Point 1: z (0 for 2D)0
Point 2: x4
Point 2: y6
Point 2: z (0 for 2D)0
Euclidean (straight-line) distance5
Chebyshev distance (largest single difference)4
  1. Man=|4−1|+|6−2|+|0−0|=7

Manhattan distance |Δx| + |Δy| + |Δz| 7

Each step uses the unrounded value of the step before it; figures on this page are rounded for display.

Frequently asked questions

What is the Manhattan distance from (1, 2) to (4, 6)?

|4 − 1| + |6 − 2| = 3 + 4 = 7, while the straight-line distance is 5.

Where is Manhattan distance used?

In grid path-finding, in machine learning (L1 norm, k-nearest neighbors) and for travel along city blocks.

Questions answered

Related calculators