StatGardenREF. DESK
Calculators/Maths/Manhattan (taxicab) distance
Maths

Manhattan (taxicab) distance calculator

Grid-style distance between two points, moving only along axes.

What this calculator does

Manhattan (taxicab) distance works out grid-style distance between two points, moving only along axes. Enter your own figures above and the answer updates as you type: nothing is fixed in the code, so the result reflects exactly the numbers you supply.

The formula this calculator evaluates is printed under the tool and explained below, so you can check the working by hand or reuse it in a spreadsheet.

The formula

Formulad = |x₂−x₁| + |y₂−y₁| + |z₂−z₁| (z optional, for 3D)

The inputs explained

FieldWhat to enter
x₁A number. Starts at 1.
y₁A number. Starts at 1.
z₁ (optional)A number. Starts at 0.
x₂A number. Starts at 6.
y₂A number. Starts at 9.
z₂ (optional)A number. Starts at 0.

Worked examples

Every figure in the tables below is produced by this page’s own calculator at build time, so the numbers and the tool always agree. Select any row to load that scenario.

How the answer changes with x₁

Every other input is held at the calculator’s starting values while x₁ varies. Select any row to load that scenario into the calculator.

How the answer changes with x₁
x₁Manhattan distanceComponent differences (Δx, Δy, Δz)Straight-line (Euclidean) distance for comparison
0.513.5005.500, 8.000, 09.708
0.7513.2505.250, 8.000, 09.569
113.0005.000, 8.000, 09.434
1.512.5004.500, 8.000, 09.179
212.0004.000, 8.000, 08.944
311.0003.000, 8.000, 08.544