Euclidean Distance
Compute L2 distance between two vectors.
About this tool
Enter two vectors of the same length and get the Euclidean (L2) distance, the straight-line distance between them. It works in any number of dimensions, not just 2D or 3D.
How to use
How it works
d(a, b) = √Σ(aᵢ − bᵢ)². Larger values mean the points are further apart. Unlike cosine similarity, Euclidean distance depends on the magnitude of the vectors, so scale features first.
d(a, b) = √( Σ (aᵢ − bᵢ)² )
Worked example
A 3-4-5 triangle
- Input
- A = 1, 2, 3 B = 4, 6, 3
- Output
- 5
- Walkthrough
- The differences are 3, 4 and 0, so the distance is √(9 + 16 + 0) = √25 = 5.
Limitations
- Both vectors must be the same length.
- Sensitive to scale; normalise features with very different ranges first.
Questions
How do I calculate Euclidean distance?
What is the difference between L1 and L2 distance?
Is Euclidean distance good for embeddings?
Does it work in 100 dimensions?
Features
- Any dimension
- Instant result
- Runs in your browser
Related resources
Guides and videos from around the web—opens on YouTube or the publisher’s site.
Mean, Variance and Standard Deviation
StatQuest with Josh Starmer
Stats foundations behind many ML metrics tools.
Watch on YouTubeTensorFlow 2.0 Complete Course
freeCodeCamp.org
Practical ML stack context next to AI utilities.
Watch on YouTube
- DeepLearning.AI
DeepLearning.AI
Courses and explainers for modern AI tooling.
- Metrics and scoring
scikit-learn
Precision, recall, F1 definitions used by AI metric tools.