Manhattan Distance
Calculate the Manhattan (taxicab) distance between two points and compare with Euclidean distance
Did our AI summary help? Let us know.
Why: Understanding manhattan distance helps you make better, data-driven decisions.
How: Enter your values below and results will compute automatically.
Run the calculator when you are ready.
Enter Two Points
Point 1 (Pโ)
Point 2 (Pโ)
For educational and informational purposes only. Verify with a qualified professional.
Key Takeaways
- โข Manhattan distance measures distance along grid lines.
- โข It is always Euclidean distance; equal only when points share x or y.
- โข Named after Manhattan's grid layout โ you cannot walk diagonally through buildings.
- โข Also called L1 distance, taxicab distance, or city block distance.
- โข Used in machine learning (k-NN), robotics pathfinding, and urban planning.
Did You Know?
Used in city navigation where movement is restricted to grid patterns.
L1 distance is used in k-NN, clustering, and Lasso regression.
Used in certain image analysis and edge detection tasks.
Helpful for wiring layouts on circuit boards and chips.
Pathfinding in grid-based environments often uses Manhattan distance.
Knight moves and rook moves relate to different distance metrics.
Understanding Manhattan Distance
Manhattan distance measures the sum of absolute differences in each coordinate. It represents the shortest path when movement is restricted to horizontal and vertical directions only.
Euclidean distance (straight line): . Manhattan is always Euclidean.
Expert Tips
When Equal
Manhattan equals Euclidean only when the points lie on a horizontal or vertical line.
Diagonal Maximum
For a diagonal path, Manhattan = โ2 ร Euclidean (e.g., (0,0) to (1,1)).
Symmetry
Distance from A to B equals distance from B to A. Order does not matter.
3D Extension
In 3D: d = |ฮx| + |ฮy| + |ฮz|.
Frequently Asked Questions
What is Manhattan distance?
The sum of absolute differences in coordinates: |xโ-xโ| + |yโ-yโ|. It measures distance along grid lines.
Why is it called Manhattan?
Manhattan streets form a grid. A taxi cannot drive through buildings, so the shortest path follows the grid.
When does Manhattan equal Euclidean?
When both points share the same x-coordinate or the same y-coordinate (horizontal or vertical line).
What is L1 distance?
Another name for Manhattan distance. L1 norm: sum of absolute values of differences.
How does it compare to Euclidean?
Manhattan is always โฅ Euclidean. For diagonal paths, Manhattan = โ2 ร Euclidean.
Where is it used?
k-NN, clustering, image processing, robotics, urban planning, and network design.
Can it be zero?
Yes, when both points are identical. Then |ฮx| = |ฮy| = 0.
How to Use This Calculator
- Enter the coordinates of two points (xโ, yโ) and (xโ, yโ).
- Click "Calculate" to get Manhattan and Euclidean distances.
- Use sample examples to load preset inputs.
Disclaimer: Manhattan distance assumes movement along grid lines. For geographic coordinates, use specialized geodesic formulas.
Related Calculators
Three D Distance Calculator
Three D Distance Calculator - Calculate and learn about coordinate-geometry concepts
MathematicsCentroid Calculator
Centroid Calculator - Calculate and learn about coordinate-geometry concepts
MathematicsEndpoint Calculator
Endpoint Calculator - Calculate and learn about coordinate-geometry concepts
MathematicsGradient Calculator
Gradient Calculator - Calculate and learn about coordinate-geometry concepts
MathematicsRotation Calculator
Rotation Calculator - Calculate and learn about coordinate-geometry concepts
MathematicsVector Calculator
Vector Calculator - Calculate and learn about coordinate-geometry concepts
Mathematics