Manhattan Distance Calculator

Enter the coordinates of two points to get their Manhattan (taxicab) distance, along with the Euclidean and Chebyshev distances for comparison.

Quick Facts

Manhattan (L1) formula
d₁ = |x₂−x₁| + |y₂−y₁| + |z₂−z₁|
Also called taxicab or city block distance — sum of axis-aligned steps.
Euclidean (L2) formula
d₂ = √((x₂−x₁)² + (y₂−y₁)² + (z₂−z₁)²)
The straight-line "as the crow flies" distance.
Ordering of norms
d∞ ≤ d₂ ≤ d₁
Chebyshev ≤ Euclidean ≤ Manhattan for the same two points.

Your Results

Calculated
Manhattan Distance
-
d₁ = |Δx| + |Δy| + |Δz|
Euclidean Distance
-
d₂ = √(Δx² + Δy² + Δz²)
Chebyshev Distance
-
d∞ = max(|Δx|, |Δy|, |Δz|)
Axis Differences
-
Δx, Δy, Δz between the points

Ready

Enter coordinates for both points, then press Calculate.

How to Calculate Manhattan Distance

Manhattan distance — also called taxicab distance or city block distance — measures how far apart two points are if you can only move along axis-aligned directions, like a taxi restricted to a city grid of streets and avenues. Instead of cutting across diagonally the way straight-line (Euclidean) distance does, Manhattan distance adds up the horizontal and vertical steps separately. For two points A(x₁, y₁, z₁) and B(x₂, y₂, z₂), the formula is d₁ = |x₂−x₁| + |y₂−y₁| + |z₂−z₁|. For plain 2D points, simply drop the z term or leave it at 0.

Manhattan vs. Euclidean vs. Chebyshev distance

These three "distance" formulas differ only in how they combine the per-axis differences Δx, Δy, Δz. Manhattan distance (the L1 norm) sums the absolute differences: |Δx| + |Δy| + |Δz|. Euclidean distance (the L2 norm) is the straight-line distance from the Pythagorean theorem: √(Δx² + Δy² + Δz²). Chebyshev distance (the L∞ norm) takes only the single largest axis difference: max(|Δx|, |Δy|, |Δz|). For any pair of points these always satisfy d∞ ≤ d₂ ≤ d₁, with all three equal only when the points differ along a single axis.

Why it matters and where it's used

Manhattan distance is the natural metric whenever movement is restricted to a grid: navigating city blocks, counting rook or king moves on part of a chessboard, or routing wires on a circuit board that only run horizontally and vertically. In data science and machine learning it appears as the L1 norm, used in k-nearest-neighbors classification, L1 regularization (Lasso), and clustering algorithms, because it is less sensitive to large outliers in any single dimension than the squared differences used by Euclidean distance.

Frequently Asked Questions

What is the formula for Manhattan distance?
Manhattan distance (also called taxicab or city block distance) sums the absolute differences of each coordinate: d = |x2−x1| + |y2−y1| + |z2−z1| for 3D points (drop the z term for 2D). It measures the distance you would travel moving only along grid-aligned axes, like a taxi driving city blocks instead of cutting diagonally.
How is Manhattan distance different from Euclidean distance?
Euclidean distance is the straight-line distance, calculated as the square root of the sum of squared differences: d = √((x2−x1)² + (y2−y1)² + (z2−z1)²). Manhattan distance sums absolute differences instead of squaring them, so it is always greater than or equal to the Euclidean distance between the same two points, and equal only when the points share every coordinate but one.
Can Manhattan distance be used with more than two or three dimensions?
Yes. Manhattan distance generalizes to any number of dimensions: sum the absolute difference of each corresponding coordinate pair. This calculator covers 2D and 3D points, but the same formula extends directly to higher-dimensional data such as feature vectors in machine learning.
Where is Manhattan distance used in practice?
It is common in grid-based pathfinding (city navigation, chessboard rook moves, warehouse robotics), in machine learning as the L1 norm for regularization and k-nearest-neighbors, and in circuit design where wires run only horizontally or vertically.