Math
Manhattan Distance Calculator
Type two points as comma-separated coordinates in any dimension. mathcheck adds the absolute coordinate differences to get the Manhattan distance, and at the same time reports the straight-line Euclidean distance (as an exact radical when possible) and the Chebyshev distance (the largest single difference) so you can see how the three metrics compare.
Coordinates separated by commas or spaces. Any dimension.
Must have the same number of coordinates as P.
Try an example
Result
Manhattan distance (L1)
—
- Euclidean distance (L2)
- —
- Chebyshev distance (L∞)
- —
- |Coordinate differences|
- —
- Dimension
- —
- Manhattan ÷ Euclidean
- —
Student quick launch
Grade planning, algebra checks, and formulas students reach for most.
Study path
Use this calculator with
Follow these when you want the formula behind the answer, a short lesson, or nearby tools in the same topic.
What Manhattan distance measures
On a city grid you cannot cut diagonally through blocks; you travel along streets, east-west and north-south. The Manhattan distance counts exactly that: the sum of the absolute differences in each coordinate. It is also called the taxicab distance, city-block distance, or L1 distance, and it is used in routing, machine learning, chess-like grid games, and compressed sensing.
| Metric | Moves allowed | Unit 'circle' |
|---|---|---|
| Manhattan (L1) | along axes only | a diamond |
| Euclidean (L2) | any direction | a circle |
| Chebyshev (L∞) | any direction, diagonals free (king moves) | a square |
(1, 2, 3) to (4, -2, 5)
Differences: |3|, |-4|, |2|. Manhattan = 3 + 4 + 2 = 9. Euclidean = sqrt(9 + 16 + 4) = √29 ≈ 5.385. Chebyshev = 4.
How to use this calculator
- Type the coordinates of the first point, separated by commas, in any dimension.
- Type the second point with the same number of coordinates.
- Read the Manhattan distance, then the Euclidean and Chebyshev distances beneath it.
- Open Show the work to see each absolute difference and how the three metrics combine them.
How to read the answer
The Manhattan distance is never smaller than the Euclidean distance and never larger than √n times it. The ratio reported tells you how much longer the grid route is than the straight line. The Chebyshev distance is the number of king moves on a chessboard between the two squares. All three are 0 only when the points coincide.
Common mistakes and edge cases
- Forgetting the How far a number sits from zero, so the answer is never negative.; negative differences must be made positive before adding.
- Squaring the differences (that is the Euclidean formula) or taking a square root of the sum.
- Comparing points with different numbers of coordinates; the formula needs matched pairs.
- Using Manhattan distance where diagonal movement is allowed at unit cost; Chebyshev distance is the right choice there.
Worked examples
3D points
(1, 2, 3) to (4, -2, 5)
Manhattan distance (L1)
9
2D grid walk
(0, 0) to (3, 4): 7 blocks, 5 as the crow flies
Manhattan distance (L1)
7
Negative coordinates
(-1, -1) to (2, 3)
Manhattan distance (L1)
7
Identical points
Manhattan distance (L1)
0
Decimals in 4D
(0.5, 1.5, -2, 0) to (1, 1, 1, 2.5)
Manhattan distance (L1)
6.5
Single coordinate differs
All three metrics agree
Manhattan distance (L1)
6
Mismatched dimensions
Manhattan distance (L1)
—
Unreadable input
Manhattan distance (L1)
—
Frequently asked questions
What is the Manhattan distance formula?+
Add the absolute differences of the coordinates: |x2 - x1| + |y2 - y1| in 2D, with one more term for each extra dimension. It measures travel restricted to the axis directions.
Why is it called Manhattan or taxicab distance?+
Because a taxi in Manhattan's street grid must drive along avenues and streets rather than cutting diagonally, so its trip length is the sum of the east-west and north-south distances.
Is the Manhattan distance always larger than the Euclidean distance?+
It is never smaller. They are equal when only one coordinate changes; otherwise Manhattan is larger, by up to a factor of √n in n dimensions (√2 ≈ 1.414 in the plane).
What is Chebyshev distance?+
The largest single coordinate difference. It counts the moves of a chess king, which can step diagonally, and it is the L∞ norm of the difference vector.
When should I use Manhattan distance instead of Euclidean?+
When movement or cost is genuinely axis-aligned (grid maps, warehouse aisles, circuit routing), when features are on different scales and you want each to count linearly, or in high-dimensional data where L1 is more robust to outliers.
Does the calculator work in more than three dimensions?+
Yes. Type as many coordinates as you need (up to 50) for each point; the formulas extend term by term.
About this calculator
- Written by
- mathcheck editorial team
- Last reviewed
- September 4, 2026
Method
- Uses the values entered by the user and stable formulas documented on the page.
Related calculators
Distance Formula Calculator
Find the distance between two coordinate points with dx, dy, squared distance, and square-root steps.
3D Distance Calculator
Find the distance between two points in 3D space with the exact radical form and decimal, plus the midpoint, the direction vector from P to Q, its unit vector, and direction angles.
Cosine Similarity Calculator
Compute the cosine similarity of two vectors of any length with the dot product, both magnitudes, the exact rationalized value when possible, the angle between the vectors, and the cosine distance.
Vector Magnitude and Direction Calculator
Find the magnitude (length) and direction angle of a 2D or 3D vector from its components or from two points. Exact radical magnitude, unit vector, direction cosines, and an arrow diagram.
Absolute Value Calculator
Find |x| for any number with the number-line meaning, the distance |a - b| between two numbers, or solve absolute value equations |ax + b| = c by splitting into two cases, all with steps.
Midpoint Calculator
Find the midpoint between two coordinate points with coordinate-average steps.
Last updated: September 4, 2026