The distance between two points is the length of the straight line that connects them. In a coordinate system, each point is written as a set of numbers (coordinates). This calculator lets you enter the coordinates of two points in 2D (x, y) or 3D (x, y, z) and returns the Euclidean straight-line distance between them.
In 2D, a point has coordinates (x1, y1) or (x2, y2). In 3D, a point has coordinates (x1, y1, z1) or (x2, y2, z2). The calculator automatically switches between 2D and 3D distance based on whether you provide z-coordinates.
The formulas used by this calculator come directly from the Pythagorean theorem, which relates the sides of a right triangle. The straight-line distance between two points is the length of the hypotenuse of a right triangle built from the coordinate differences.
For two points in the plane, (x1, y1) and (x2, y2), the Euclidean distance d between them is:
d = √[(x2 − x1)² + (y2 − y1)²]
For two points in space, (x1, y1, z1) and (x2, y2, z2), the Euclidean distance d between them is:
d = √[(x2 − x1)² + (y2 − y1)² + (z2 − z1)²]
To see where these formulas come from, imagine plotting the two points on a coordinate grid.
These two differences form the legs of a right triangle. The distance between the points is the hypotenuse. By the Pythagorean theorem:
d² = (Δx)² + (Δy)²
Taking the square root of both sides gives the 2D distance formula. In 3D, there is an extra dimension with difference Δz = z2 − z1. The length now satisfies:
d² = (Δx)² + (Δy)² + (Δz)²
Again taking the square root gives the 3D formula. This is an example of the Euclidean metric, which measures straight-line separation in standard Cartesian space.
2D vs 3D:
The calculation runs entirely in your browser. The coordinates you type are not sent to a server.
Suppose you have two points in the plane:
Step 1: Compute the differences:
Step 2: Apply the 2D distance formula:
d = √[(Δx)² + (Δy)²] = √[(4)² + (3)²] = √(16 + 9) = √25 = 5
The straight-line distance between (1, 2) and (5, 5) is 5 units.
Now consider two points in 3D space:
Step 1: Compute the coordinate differences:
Step 2: Apply the 3D distance formula:
d = √[(Δx)² + (Δy)² + (Δz)²] = √[(4)² + (3)² + (4)²] = √(16 + 9 + 16) = √41
Numerically, √41 ≈ 6.403. So the straight-line distance between the two 3D points is about 6.403 units.
Interpreting the result is straightforward: the distance tells you how far apart the two points are in a straight line, using the same units as your coordinates (meters, kilometers, inches, etc.). A larger value means the points are farther apart.
Typical uses include:
Because the formula is based on squared differences, negative coordinate values do not cause problems. Only the relative differences between the coordinates matter, and the final distance is always non‑negative.
The table below compares the key features of the 2D and 3D formulas used by this calculator.
| Aspect | 2D distance | 3D distance |
|---|---|---|
| Point format | (x1, y1) and (x2, y2) | (x1, y1, z1) and (x2, y2, z2) |
| Formula | d = √[(x2 − x1)² + (y2 − y1)²] | d = √[(x2 − x1)² + (y2 − y1)² + (z2 − z1)²] |
| Dimensions measured | Horizontal and vertical separation in a flat plane | Separation in three perpendicular directions (often width, height, depth) |
| Typical use cases | Graphs, maps of small areas, 2D diagrams, basic geometry problems | 3D models, physics in space, engineering drawings, 3D games |
| Calculator inputs | Only x and y fields filled; z fields left empty | All x, y, and z fields filled for both points |
This calculator makes several important assumptions:
If you keep these assumptions in mind, the distance formula is a reliable and widely applicable tool for measuring how far apart two points are in both 2D and 3D settings.