Manhattan Distance Calculator
Calculate the Manhattan (L1) distance between two vectors.
About Manhattan Distance Calculator
Manhattan distance (L1 norm) measures the sum of absolute differences along each dimension, like navigating a grid of city blocks. It is more robust to outliers than Euclidean distance and commonly used in high-dimensional sparse feature spaces.
Formula
Manhattan Distance
d(a, b) = sum(|a_i - b_i|)
- a, b
- Input vectors
Worked example
With the default values below, Manhattan Distance Calculator returns Manhattan Distance of 9.000000. Change any input above and every figure here is recalculated in your browser.
Inputs used
- Vector A
- 1, 2, 3
- Vector B
- 4, 5, 6
Results
- Manhattan Distance
- 9.000000
- Dimensions
- 3
Step by step
- 1Sum of absolute differences= 9.000000
Assumptions and limits
- The result is derived only from the 2 inputs listed above. Anything not among them is not part of the calculation.
- In particular, this calculator does not take inflation, tax, fees or charges or compounding frequency into account.
- Figures are rounded for display to 6 decimal places, so totals built from several rounded parts can differ slightly from the unrounded arithmetic.
How these calculators are built and tested is described on the Methodology page. If a figure looks wrong, please report it.
Frequently Asked Questions
Why is it called Manhattan distance?
It resembles the distance a taxi would travel on a grid-based street layout (like Manhattan), where you can only move along axes rather than diagonally.
When is Manhattan distance preferred over Euclidean?
Manhattan distance is preferred when features are on different scales or when the data is sparse and high-dimensional, as it is less affected by large differences in a single dimension.
