How this instrument works
Manhattan distance measures how far apart two points are if travel is confined to a grid — never diagonal. Add the horizontal gap to the vertical gap: d = |x₂−x₁| + |y₂−y₁|. The name comes from Manhattan's street layout, where an avenue and a cross street meet at a right angle and a cab has to follow the pavement around a block rather than plough straight through it. Between (1, 2) and (4, 6), the eastward gap is 3 blocks and the northward gap is 4 blocks, so the total drive is 7 blocks — not the 5-block beeline a bird would take.
Mathematicians class this alongside ordinary straight-line distance as one member of a family Hermann Minkowski formalized around 1900: raise each coordinate gap to a power p, sum them, and take the p-th root. Set p = 1 and the power and root cancel, leaving a plain sum of absolute values — the taxicab or L1 distance. Set p = 2 and the familiar square-root-of-squares formula returns. The two never agree except when the points share a row or column, because a diagonal is always shorter than the staircase of horizontal-and-vertical steps needed to trace around it.
A property that surprises most people the first time they meet it: on a grid, the shortest route between two points is almost never unique. From (1, 2) to (4, 6) there are 3 eastward steps and 4 northward steps to arrange in any order — 35 different staircases, by the count of 7 choose 3 — and every single one covers exactly 7 blocks. A straight line has exactly one shortest path; a city grid has as many as there are ways to interleave 'east' and 'north.'
- Enter the starting point's coordinates in x₁ and y₁ — any consistent unit, positive or negative, works.
- Enter the destination's coordinates in x₂ and y₂.
- Read Manhattan distance: the sum of the horizontal and vertical gaps, with no diagonal shortcut taken.
- Swap which point is first and which is second if you like — each gap is measured with absolute value, so the reading doesn't change.
Worked example — seven blocks from (1, 2) to (4, 6)
Set x₁ = 1, y₁ = 2, x₂ = 4, y₂ = 6. The horizontal gap is Δx = 4 − 1 = 3 and the vertical gap is Δy = 6 − 2 = 4. Manhattan distance sums the two: d = |3| + |4| = 7. A straight line between the same points would run only 5 units — the familiar 3-4-5 right triangle — so the grid detour costs exactly 2 extra units of travel.
That 7-unit trip is not unique. Any path that takes 3 steps east and 4 steps north, in any order, also totals 7 — combinations counted by 7 choose 3, which works out to 35 distinct routes. Reverse the point order to (4, 6) and (1, 2) and the arithmetic runs the same way: |1 − 4| + |2 − 6| = 3 + 4 = 7, because absolute value erases which point was named first.
Questions
What is Manhattan distance, and where does the name come from?
It's the sum of the horizontal and vertical gaps between two points, d = |x₂−x₁| + |y₂−y₁|, measured the way a car has to travel on a grid of streets rather than as the crow flies. The name refers to Manhattan's rectangular block layout, where a cab can't cut diagonally through a building to shorten a trip — it has to follow the streets.
How is this different from ordinary straight-line distance?
Straight-line (Euclidean) distance squares each gap, adds them, and takes a root: for this page's example that gives √(3² + 4²) = 5. Manhattan distance skips the squaring and just adds the absolute gaps, giving 3 + 4 = 7. The straight line is always the shorter of the two, or equal to it, because a diagonal is never longer than the staircase of horizontal-and-vertical steps needed to trace around it.
Why is Manhattan distance also called taxicab or L1 distance?
Taxicab and Manhattan describe the same idea — a vehicle confined to a street grid. L1 refers to its place in a family of distance formulas Hermann Minkowski described: raise each coordinate gap to the power p and sum before taking the p-th root; at p = 1 the root cancels the power, leaving a plain sum of absolute values, while p = 2 gives the familiar Euclidean distance.
Does it matter which point I enter first?
No. Each gap is wrapped in absolute value before it's added, so |x₂−x₁| equals |x₁−x₂| regardless of which point carries the subscript 1. Labeling (4, 6) as the first point and (1, 2) as the second still returns 7 — only the pairing of each x with its matching y has to stay consistent.
What's the most common mistake when computing this by hand?
Forgetting the absolute value and subtracting in a fixed order — if x₁ happens to exceed x₂, that term comes out negative and quietly cancels part of the total instead of adding to it. The fix is to take the magnitude of each gap before summing, never the raw signed difference; this sheet applies the absolute value automatically so a reversed pair of points can't produce a wrong or negative reading.
Where does Manhattan distance show up outside of city navigation?
It's the L1 penalty behind LASSO regression, where it favors sparse solutions by summing absolute coefficient sizes rather than squares; it also underlies rook-move counting on a chessboard-like grid and several image-processing filters that compare pixels by grid position rather than straight-line distance. Anywhere movement is restricted to axis-aligned steps, this formula is the natural one to reach for.