Euclidean distance is the straight-line distance between two points in Euclidean space. In a two-dimensional Cartesian plane, it is calculated with:
Distance = √[(x₂ − x₁)² + (y₂ − y₁)²]
The same idea extends to three dimensions and higher-dimensional coordinate systems by adding the squared difference for each additional coordinate.
This page explains what Euclidean distance means, where the formula comes from, how to calculate it, and when it should not be used.
What Is Euclidean Distance?
Euclidean distance is the ordinary straight-line distance between two points in a flat coordinate system.
For two points:
A = (x₁, y₁)
B = (x₂, y₂)
Euclidean distance measures the length of the line segment connecting A and B.
It is the standard distance used in Cartesian geometry and is based on the Pythagorean theorem.
For a broader overview of distance methods, see the Distance Formula hub.
What Is the Euclidean Distance Formula?
For two points in two dimensions:
A = (x₁, y₁)
B = (x₂, y₂)
the Euclidean distance formula is:
Distance = √[(x₂ − x₁)² + (y₂ − y₁)²]
Where:
| Symbol | Meaning |
|---|---|
| x₁ | x-coordinate of Point A |
| y₁ | y-coordinate of Point A |
| x₂ | x-coordinate of Point B |
| y₂ | y-coordinate of Point B |
| Distance | Straight-line Euclidean distance |
This formula gives the shortest distance between two points on a flat Cartesian plane.
How Is Euclidean Distance Derived?
The formula comes directly from the Pythagorean theorem.
Suppose two points are:
A = (x₁, y₁)
B = (x₂, y₂)
Their horizontal separation is:
Δx = x₂ − x₁
Their vertical separation is:
Δy = y₂ − y₁
These two differences form the perpendicular sides of a right triangle.
The straight-line distance between A and B is the hypotenuse.
By the Pythagorean theorem:
Distance² = Δx² + Δy²
Substitute the coordinate differences:
Distance² = (x₂ − x₁)² + (y₂ − y₁)²
Take the square root:
Distance = √[(x₂ − x₁)² + (y₂ − y₁)²]
That is the Euclidean distance formula.
How Do You Calculate Euclidean Distance?
Use five steps:
- Identify both coordinate pairs.
- Subtract the x-coordinates.
- Subtract the y-coordinates.
- Square and add the differences.
- Take the square root.
For example, calculate the distance between:
A = (2, 1)
B = (8, 5)
First, calculate the x-difference:
8 − 2 = 6
Then the y-difference:
5 − 1 = 4
Apply the formula:
Distance = √(6² + 4²)
Distance = √(36 + 16)
Distance = √52
Distance ≈ 7.21 units
So, the Euclidean distance between the points is approximately 7.21 units.
Example With a 3-4-5 Triangle
One of the simplest Euclidean distance examples uses:
A = (0, 0)
B = (3, 4)
Calculate:
Distance = √[(3 − 0)² + (4 − 0)²]
Distance = √(3² + 4²)
Distance = √(9 + 16)
Distance = √25
Distance = 5 units
The result is 5 because these coordinate differences form a 3-4-5 right triangle.
Example With Negative Coordinates
Euclidean distance works the same way with negative coordinates.
Suppose:
A = (−4, 2)
B = (3, −3)
Calculate the x-difference:
3 − (−4) = 7
Calculate the y-difference:
−3 − 2 = −5
Apply the formula:
Distance = √[7² + (−5)²]
Distance = √(49 + 25)
Distance = √74
Distance ≈ 8.60 units
The negative y-difference does not make the final distance negative because the difference is squared.
Example With Decimal Coordinates
Suppose:
A = (1.2, 2.5)
B = (4.8, 7.3)
Calculate:
Δx = 4.8 − 1.2 = 3.6
Δy = 7.3 − 2.5 = 4.8
Then:
Distance = √(3.6² + 4.8²)
Distance = √(12.96 + 23.04)
Distance = √36
Distance = 6 units
Decimal coordinates do not require a different formula.
What Is Euclidean Distance in Three Dimensions?
For three-dimensional Cartesian points:
A = (x₁, y₁, z₁)
B = (x₂, y₂, z₂)
the Euclidean distance formula becomes:
Distance = √[(x₂ − x₁)² + (y₂ − y₁)² + (z₂ − z₁)²]
OpenStax gives this as the standard distance formula between two points in three-dimensional space.
For example:
A = (1, 2, 3)
B = (5, 5, 6)
Calculate:
Δx = 5 − 1 = 4
Δy = 5 − 2 = 3
Δz = 6 − 3 = 3
Then:
Distance = √(4² + 3² + 3²)
Distance = √(16 + 9 + 9)
Distance = √34
Distance ≈ 5.83 units
What Is the Euclidean Distance Formula in n Dimensions?
The formula can be extended to any number of dimensions.
Suppose:
A = (a₁, a₂, …, aₙ)
B = (b₁, b₂, …, bₙ)
Then:
Distance = √[(b₁ − a₁)² + (b₂ − a₂)² + … + (bₙ − aₙ)²]
MathWorld describes this as the standard Euclidean metric in (R^n).
Each dimension contributes one squared coordinate difference.
This generalized form appears in areas such as:
- geometry;
- physics;
- data analysis;
- optimization;
- computer graphics;
- machine learning.
The underlying idea remains the same: combine the differences across all coordinate dimensions into one straight-line distance.
What Is Cartesian Distance?
Cartesian distance is another way to describe Euclidean distance between points represented in a Cartesian coordinate system.
In 2D:
Point = (x, y)
In 3D:
Point = (x, y, z)
The x-axis, y-axis, and z-axis are mutually perpendicular coordinate directions.
The Euclidean formula measures the straight-line separation based on differences along those axes.
So in ordinary coordinate geometry:
Cartesian distance = Euclidean distance
when the coordinate system uses the standard Euclidean metric.
What Is the Coordinate Distance Formula?
For ordinary Cartesian coordinates, the coordinate distance formula is the Euclidean distance formula.
For two 2D points:
A = (x₁, y₁)
B = (x₂, y₂)
use:
Distance = √[(x₂ − x₁)² + (y₂ − y₁)²]
For more practical step-by-step examples, see Distance Between Two Points.
What Is the Vector Form of Euclidean Distance?
Euclidean distance can also be expressed using vectors.
Suppose the position vectors of two points are:
a = (a₁, a₂, …, aₙ)
b = (b₁, b₂, …, bₙ)
The difference vector is:
b − a
The Euclidean distance is the magnitude of that difference vector:
Distance = ‖b − a‖
In expanded form:
Distance = √[(b₁ − a₁)² + (b₂ − a₂)² + … + (bₙ − aₙ)²]
This form is especially useful in linear algebra, vector geometry, physics, and data science.
What Properties Does Euclidean Distance Have?
Euclidean distance follows several important mathematical properties.
Distance Is Nonnegative
Distance ≥ 0
A distance can never be negative.
Identical Points Have Zero Distance
If:
A = B
then:
Distance(A, B) = 0
Reversing the Points Does Not Change Distance
Distance(A, B) = Distance(B, A)
The coordinate differences change sign when the points are reversed, but their squares remain the same.
The Triangle Inequality Applies
For three points A, B, and C:
Distance(A, C) ≤ Distance(A, B) + Distance(B, C)
The direct Euclidean distance between two points cannot exceed the length of a route that goes through a third point.
These properties are part of why Euclidean distance is a valid mathematical metric.
Can Euclidean Distance Be Zero?
Yes, but only when the two coordinate points are identical.
For:
A = (4, 7)
B = (4, 7)
calculate:
Distance = √[(4 − 4)² + (7 − 7)²]
Distance = √(0 + 0)
Distance = 0
Any two distinct points have a positive Euclidean distance.
Can Euclidean Distance Be Negative?
No.
A coordinate difference may be negative, but squaring removes the sign.
For example:
(−6)² = 36
The sum inside the square root is therefore nonnegative, and the resulting Euclidean distance is nonnegative.
Does the Order of Points Matter?
No.
Suppose:
A = (1, 2)
B = (5, 7)
From A to B:
Δx = 5 − 1 = 4
From B to A:
Δx = 1 − 5 = −4
But:
4² = (−4)²
The same applies to every coordinate dimension.
Therefore:
Distance(A, B) = Distance(B, A)
What Is Euclidean Distance From the Origin?
The origin in a 2D Cartesian plane is:
O = (0, 0)
For another point:
P = (x, y)
the Euclidean distance from the origin is:
Distance = √(x² + y²)
For example:
P = (6, 8)
Then:
Distance = √(6² + 8²)
Distance = √(36 + 64)
Distance = √100
Distance = 10 units
This is also the magnitude of the position vector (6, 8).
What Is the Difference Between Euclidean Distance and Manhattan Distance?
Euclidean distance measures the straight-line path between two points.
Manhattan distance measures the sum of the absolute coordinate differences.
For two 2D points:
A = (x₁, y₁)
B = (x₂, y₂)
Euclidean distance is:
√[(x₂ − x₁)² + (y₂ − y₁)²]
Manhattan distance is:
|x₂ − x₁| + |y₂ − y₁|
For example:
A = (0, 0)
B = (3, 4)
Euclidean distance:
√(3² + 4²) = 5
Manhattan distance:
|3| + |4| = 7
The two metrics answer different geometric questions.
This page focuses on Euclidean distance because that is the standard straight-line coordinate distance used in ordinary Cartesian geometry.
Euclidean Distance vs Great-Circle Distance
Euclidean distance assumes flat geometry.
Great-circle distance accounts for movement along a spherical surface.
| Feature | Euclidean Distance | Great-Circle Distance |
|---|---|---|
| Geometry | Flat | Spherical |
| Typical coordinates | x, y, z | Latitude, longitude |
| Standard use | Cartesian space | Geographic Earth distance |
| Curvature | Not included | Included |
| Typical formula | Pythagorean-based | Haversine or other geodesic method |
Do not treat latitude and longitude as ordinary x- and y-values if you want geographic distance in miles or kilometers.
Use the Distance Calculator for geographic coordinates and read the Haversine Formula guide for the underlying spherical calculation.
Can Euclidean Distance Be Used for Latitude and Longitude?
Only in limited local approximations where the coordinate system has first been transformed appropriately.
Raw latitude and longitude are angular coordinates on Earth's curved surface.
Using:
√[(longitude₂ − longitude₁)² + (latitude₂ − latitude₁)²]
does not directly produce a meaningful distance in miles or kilometers.
For general geographic calculations, use a geodesic or great-circle method.
Our Distance Calculator uses the Haversine formula for this purpose.
Euclidean Distance vs Driving Distance
Euclidean distance measures direct geometric separation.
Driving distance follows a road network.
Even if two places appear close on a map, road mileage can be longer because vehicles must follow actual streets and available connections.
For road-based calculations, use the Driving Distance Calculator.
For the conceptual comparison, read Driving Distance vs Straight-Line Distance.
When Should You Use Euclidean Distance?
Euclidean distance is appropriate when your coordinate system behaves like flat Euclidean space.
Common cases include:
- coordinate geometry problems;
- points on graphs;
- engineering coordinate systems;
- vector calculations;
- computer graphics;
- local projected coordinates;
- feature-space comparisons in data analysis.
The key requirement is that straight-line geometry is meaningful in the coordinate system being used.
When Should You Not Use Euclidean Distance?
Do not automatically use Euclidean distance when the geometry or metric is different.
Examples include:
- long-distance latitude/longitude calculations;
- road-network distance;
- walking-route distance;
- travel-time distance;
- curved surfaces;
- coordinate systems where axes use incompatible units.
The formula may still be mathematically calculable, but the result may not represent the real-world distance you intended to measure.
Common Euclidean Distance Mistakes
Mixing the Coordinates
Subtract x from x and y from y.
Correct:
x₂ − x₁
y₂ − y₁
Losing Negative Signs
Write:
3 − (−4) = 7
not:
3 − 4 = −1
Forgetting the Squares
The formula uses squared coordinate differences.
Forgetting the Square Root
The sum of squared differences gives Distance², not the final distance.
Using the Wrong Geometry
Raw latitude and longitude require a geographic distance method.
Mixing Units
If x is measured in feet and y is measured in meters, the ordinary Euclidean result is not meaningful until the units are made compatible.
Euclidean Distance Examples at a Glance
| Points | Calculation | Distance |
|---|---|---|
| (0, 0), (3, 4) | √(3² + 4²) | 5 |
| (2, 1), (8, 5) | √(6² + 4²) | √52 ≈ 7.21 |
| (−4, 2), (3, −3) | √(7² + 5²) | √74 ≈ 8.60 |
| (1.2, 2.5), (4.8, 7.3) | √(3.6² + 4.8²) | 6 |
| (1, 2, 3), (5, 5, 6) | √(4² + 3² + 3²) | √34 ≈ 5.83 |
If you want to calculate x/y values interactively, use the Distance Formula Calculator.
Frequently Asked Questions
What is Euclidean distance?
Euclidean distance is the straight-line distance between two points in Euclidean space. In two dimensions, it is calculated as √[(x₂ − x₁)² + (y₂ − y₁)²].
What is the Euclidean distance formula in 2D?
For points (x₁, y₁) and (x₂, y₂):
Distance = √[(x₂ − x₁)² + (y₂ − y₁)²]
What is the Euclidean distance formula in 3D?
For points (x₁, y₁, z₁) and (x₂, y₂, z₂):
Distance = √[(x₂ − x₁)² + (y₂ − y₁)² + (z₂ − z₁)²]
Why is it called Euclidean distance?
It is the standard notion of distance in Euclidean geometry, where straight lines and the Pythagorean relationship define the separation between coordinate points.
Is Euclidean distance always positive?
Euclidean distance is always nonnegative. It equals 0 when the two points are identical and is positive when the points are different.
Is Euclidean distance the same as straight-line distance?
In a flat Cartesian coordinate system, yes. Euclidean distance measures the straight-line separation between points.
Can Euclidean distance be used for GPS coordinates?
Not directly for general geographic distances. Latitude and longitude lie on Earth's curved surface, so use a geographic method such as the Haversine formula instead.
