Skip to content
ENExplore Calculators

Euclidean Distance Calculator

Calculate the Euclidean distance between two vectors in n-dimensional space.

About Euclidean Distance Calculator

Euclidean distance is the straight-line distance between two points in n-dimensional space, computed as the square root of the sum of squared differences across each dimension. It is the most common distance metric used in k-nearest neighbors, clustering algorithms, and vector similarity searches.

Formula

Euclidean Distance

d(a, b) = sqrt(sum((a_i - b_i)^2))

a, b
Input vectors

Worked example

With the default values below, Euclidean Distance Calculator returns Euclidean Distance of 5.196152. Change any input above and every figure here is recalculated in your browser.

Inputs used

Vector A
1, 2, 3
Vector B
4, 5, 6

Results

Euclidean Distance
5.196152
Dimensions
3

Step by step

  1. 1Sum of squared differences= 27.0000
  2. 2Euclidean distance: √(sum)= 5.196152

Assumptions and limits

  • The result is derived only from the 2 inputs listed above. Anything not among them is not part of the calculation.
  • In particular, this calculator does not take inflation, tax, fees or charges or compounding frequency into account.
  • Figures are rounded for display to 6 decimal places, so totals built from several rounded parts can differ slightly from the unrounded arithmetic.

How these calculators are built and tested is described on the Methodology page. If a figure looks wrong, please report it.

Frequently Asked Questions

When should I use Euclidean distance vs cosine similarity?

Use Euclidean distance when the magnitude of vectors matters (e.g., physical distance, raw feature values). Use cosine similarity when only the direction matters (e.g., text embeddings, TF-IDF vectors).

Does Euclidean distance work well in high dimensions?

In very high dimensions, distances between points tend to converge (curse of dimensionality), making Euclidean distance less discriminative. Dimensionality reduction or alternative metrics may help.

Euclidean Distance Calculator | Calcrivo