Calculators

Manhattan Distance Calculator

Calculate the sum of absolute coordinate differences between two signed numeric vectors privately in your browser.

Enter equal-length numeric vectors, separated by spaces, commas or semicolons. Signed values and scientific notation are supported. Each vector allows 10000 numbers and 200000 characters. The result is the sum of absolute coordinate differences. Calculation runs locally in your browser.

Your Manhattan distance will appear here.

How Manhattan distance works

Manhattan distance, also called taxicab, city block or L1 distance, is the sum of absolute differences between corresponding coordinates: Σ|aᵢ − bᵢ|. For A = (1, 2, 3) and B = (4, 6, 3), the differences are 3, 4 and 0, so the distance is 7. Identical vectors, including two zero vectors, have distance 0. In a two-dimensional grid with horizontal and vertical moves, this measures the shortest unobstructed path when diagonal moves are not allowed. Unlike Chebyshev distance, which takes only the largest difference, Manhattan distance adds all differences. Coordinates must match in order and use comparable units and scales; the calculator does not normalize inputs. Enter 1 to 10000 finite signed decimal numbers per vector separated by spaces, commas or semicolons. Scientific notation is supported; commas separate values rather than thousands. Each input allows 200000 characters. Values that underflow to zero and differences or totals exceeding the browser numeric range are rejected. Compensated summation reduces rounding error, but results still use browser floating-point arithmetic and display up to 12 significant digits. All processing stays in your browser.

Frequently Asked Questions

Everything you need to know about this tool, how it works, and privacy.

What is the Manhattan distance formula?

Add the absolute differences between matching coordinates: Σ|aᵢ − bᵢ|. For (1, 2, 3) and (4, 6, 3), the result is 3 + 4 + 0 = 7.

Can I enter negative numbers and zeros?

Yes. Signed finite decimal numbers and scientific notation are accepted. Identical vectors, including two zero vectors, have distance zero.

How does this differ from Chebyshev distance?

Manhattan distance adds every absolute coordinate difference. Chebyshev distance takes only the largest one. Euclidean distance takes the square root of the sum of squared differences.

Do vector order and units matter?

Yes. Match coordinates in the same order and use comparable units and scales. Inputs are not normalized automatically.

Which inputs are rejected?

Empty or unequal-length vectors, non-finite values, values that underflow to zero, more than 10000 numbers or 200000 characters per vector, and differences or totals beyond the browser numeric range are rejected.