What this calculator does
Euclidean distance is the straight-line distance between two points, the length of the shortest path between them measured as the crow flies rather than along any grid. It is the distance most people mean by default when they say "the distance between two points" without qualifying it further.
The formula extends directly from two dimensions to three: square each coordinate difference, add them together, and take the square root. Leave the z-coordinates at zero to work purely in 2D; fill them in for a point in 3D space and the same formula still applies.
The formula
Subtract the coordinates of the first point from the second in each dimension, square each difference, sum the squares, then take the square root. This is a direct application of the Pythagorean theorem, extended to as many dimensions as there are coordinates.
| Term | Meaning |
|---|---|
| Euclidean distance | d = √((x₂−x₁)² + (y₂−y₁)² + (z₂−z₁)²), the straight-line distance between the two points. |
| Component differences | The separate distance along each axis (Δx, Δy, Δz) before they are combined. |
| Midpoint | The point exactly halfway between the two, averaging each coordinate separately. |
The inputs explained
| Field | What to enter |
|---|---|
| x₁ | The x-coordinate of the first point. |
| y₁ | The y-coordinate of the first point. |
| z₁ (leave at 0 for 2D) | The z-coordinate of the first point. Leave at 0 for a purely 2D calculation. |
| x₂ | The x-coordinate of the second point. |
| y₂ | The y-coordinate of the second point. |
| z₂ (leave at 0 for 2D) | The z-coordinate of the second point. Leave at 0 for a purely 2D calculation. |
When to use it
Measuring distance on a coordinate plane
Given two points from a graph, a map grid, or a set of plotted coordinates, this gives the direct straight-line distance between them.
Comparing points in a dataset
Euclidean distance is the standard way of measuring how similar or different two data points are once they are represented as coordinates, such as in clustering or nearest-neighbour comparisons.
Working in three dimensions
For points defined by x, y and z coordinates, such as positions in a 3D model or a physical space, the same formula extends cleanly by adding the z term.
Worked examples
Every figure in the tables below is produced by this page’s own calculator at build time, so the numbers and the tool always agree. Select any row to load that scenario.
How Euclidean distance changes as the second point moves further along the x-axis
A fixed origin point and a second point held 4 units up on the y-axis, moving progressively further along x.
Questions
How is Euclidean distance different from Manhattan distance?
Euclidean distance is the straight-line distance between two points. Manhattan (taxicab) distance is the sum of the distances along each axis separately, as if you could only move along a grid. Euclidean distance is always the shorter of the two, or equal when the points share every coordinate but one.
Can this be used for more than three dimensions?
The formula extends to any number of dimensions by adding more squared-difference terms, but this calculator is built for the common 2D and 3D cases specifically.
Does the order of the two points matter?
No. Squaring each difference removes the sign, so swapping which point is first and which is second gives exactly the same distance.
What if both points are identical?
The distance is zero, since every coordinate difference is zero. The midpoint in that case is just the shared point itself.
For grid-style movement instead of a straight line, see the Manhattan distance calculator. For distances measured directly on a rectangle, the rectangle and square calculator gives the diagonal between two corners.