Euclidean Distance Calculator
Compute the Euclidean (L2) distance between two points or two vectors of any dimension, in your browser. See the squared distance, the Manhattan and Chebyshev comparisons, and the full per-dimension working behind every result. No signup, nothing uploaded.
How it works
Euclidean distance is the straight-line distance between two points — the length of the segment joining them. For two equal-length vectors a = [a₁…aₙ] and b = [b₁…bₙ], it is the square root of the sum of the squared coordinate differences. It is the metric scikit-learn and NumPy use by default, and it generalises the Pythagorean theorem to any number of dimensions.
d(a, b) = √( Σ (aᵢ − bᵢ)² ) = √( (a₁ − b₁)² + … + (aₙ − bₙ)² )
The tool computes this in four steps:
- Per-dimension difference. Subtract the vectors coordinate by coordinate:
dᵢ = aᵢ − bᵢ. - Square and sum. Square each difference and add them up. This sum is the squared Euclidean distance
d² = Σ dᵢ², which equals scikit-learn'seuclidean_distances(…, squared=True). - Square root. The Euclidean distance is
d = √(d²), equivalent tonumpy.linalg.norm(a − b). - Comparison metrics. Over the same differences the tool also reports Manhattan
Σ |dᵢ|and Chebyshevmax |dᵢ|, the L1 and L∞ members of the same Minkowski family.
The 2D and 3D modes are just the n = 2 and n = 3 cases of the same sum: √((x₂ − x₁)² + (y₂ − y₁)²) and √((x₂ − x₁)² + (y₂ − y₁)² + (z₂ − z₁)²). All arithmetic is done in double-precision floating point and is rounded only for display, using the decimal places you pick. As a credibility check, the calculator computes the distance a second way — as the L2 norm of the difference vector via Math.hypot, the overflow-safe route NumPy relies on — and confirms the two agree, so even inputs around 10⁹ stay exact.
Worked examples
Frequently asked questions
Sources & references
- scikit-learn — sklearn.metrics.pairwise.euclidean_distances (plain and squared Euclidean; manhattan_distances and DistanceMetric for L1/L∞)
- NumPy — numpy.linalg.norm (the L2-norm reference implementation; distance = norm(a − b))
- Wikipedia — Euclidean distance (n-dimensional formula and the 2D/3D special cases)
The formulas on this page were last cross-checked against these sources on 2026-06-10. Euclidean distance is a stable mathematical definition, so this tool needs no rate or schedule updates — only the worked examples are periodically re-reconciled.
Related tools
Comments & feedback
Spotted a bug or want an improvement? Tell us — our team reviews every comment, and good ideas get built. Comments are public and anonymous.
Found a bug, edge case, or want to suggest an improvement?
Email me at [email protected] — most fixes ship within 24 hours.