Skip to content
Calcrivo

Euclidean Distance Calculator

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

Inputs

Comma-separated values

Comma-separated values

Euclidean Distance

5.196152

Dimensions

3

Step by step

  1. Sum of squared differences

    Σ(aᵢ − bᵢ)²

    = 27.0000

  2. Euclidean distance: √(sum)

    √27.0000

    = 5.196152

How it works

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

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.

You might also need