Manhattan Distance Calculator

Calculate the Manhattan (taxicab/L1) distance between two points or vectors of any dimension, with Euclidean distance shown for comparison.

Vector Inputs

Quick Presets

Manhattan Distance

L1 / taxicab / city-block

Euclidean Distance

L2 / straight-line

Per-Dimension Breakdown

Enter values above and click Calculate.

Formula

d(P, Q) = |P₁−Q₁| + |P₂−Q₂| + … + |Pₙ−Qₙ|

Summary

Calculate the Manhattan (taxicab/L1) distance between two points or vectors of any dimension, with Euclidean distance shown for comparison.

How it works

  1. Enter the coordinates of the first point (P) as a comma-separated list, e.g. "1, 2, 3".
  2. Enter the coordinates of the second point (Q) with the same number of dimensions.
  3. The tool computes |P1−Q1| + |P2−Q2| + … for each dimension to produce the Manhattan distance.
  4. Euclidean distance (√∑(Pi−Qi)²) is computed alongside for comparison.
  5. Component-level breakdown shows the absolute difference for each dimension.

Use cases

  • Compare feature vectors in machine-learning distance metrics (k-NN, k-means).
  • Calculate grid-based pathfinding costs in games or robotics.
  • Check distance between data points when outliers should not be over-penalized (L1 vs L2).
  • Verify algorithm output during development of spatial or clustering code.
  • Teach the difference between L1 and L2 norms in linear algebra coursework.
  • Compute pixel-wise L1 distance between image patches in computer vision.

Frequently Asked Questions

Last updated: 2026-07-22 · Reviewed by Nham Vu