Manhattan Distance Calculator
Distance Along a Grid, Not a Diagonal
Named for the way New York City's street grid forces travel along perpendicular avenues rather than in a straight diagonal line, Manhattan distance measures how far apart two points are when movement is restricted to horizontal and vertical steps. It's consistently larger than or equal to straight-line distance between the same two points, since it never gets to "cut the corner."
The Formula
The two axis differences are each taken as an absolute value and simply added together — there's no squaring or square root involved, which is what makes Manhattan distance computationally cheaper than Euclidean distance.
Where Manhattan Distance Is Used
- Grid-based navigation — city block distances, warehouse robot pathing, and any movement restricted to horizontal/vertical steps.
- Machine learning — used as an alternative distance metric (L1 norm) in clustering and nearest-neighbor algorithms, particularly with high-dimensional or sparse data.
- Circuit board design — wire routing on a chip typically follows horizontal and vertical paths only.
- Chess-like grid games — movement cost for pieces restricted to orthogonal moves.
| Point 1 | Point 2 | Manhattan Distance |
|---|---|---|
| (1, 2) | (4, 6) | 7 |
The same two points have a straight-line (Euclidean) distance of only 5, illustrating that Manhattan distance is always ≥ Euclidean distance between the same pair of points.
How to Use This Calculator
- Enter X1 and Y1 for the first point.
- Enter X2 and Y2 for the second point.
- Select Calculate to see the Manhattan distance.
Related Calculations
For straight-line distance between the same two points, see the Euclidean Distance Calculator. For a general-purpose tool covering 2D, 3D, and geographic distance, see the Distance Calculator.