Calculate the shortest straight-line distance ($D$) between two points, $P_1$ and $P_2$, in a two-dimensional (2D) or three-dimensional (3D) coordinate system. Enter the coordinates of both points below.
Endpoints $P_1$ and $P_2$
Point
X-Coordinate
Y-Coordinate
Z-Coordinate (Optional)
P₁
P₂
Leave Z coordinates blank for a 2D calculation.
Results
Distance ($D$)
Midpoint ($M$)
Step-by-Step Solution
The Euclidean Distance Formula
The distance formula is a direct application of the Pythagorean Theorem in a coordinate system. It finds the length of the hypotenuse created by the differences in the $x$ and $y$ coordinates ($\Delta x$ and $\Delta y$).
Distance Formula (2D)
Given points $P_1(x_1, y_1)$ and $P_2(x_2, y_2)$, the distance $D$ is:
$$D = \sqrt{(x_2 - x_1)^2 + (y_2 - y_1)^2}$$
Distance Formula (3D)
For three dimensions, the formula simply adds the difference in the $z$ coordinates:
The midpoint ($M$) is the coordinate point exactly halfway between the two endpoints. Since the calculation relies on the same input coordinates, this calculator provides it as a helpful related value:
The 2D distance formula finds the length of a segment connecting two points $P_1(x_1, y_1)$ and $P_2(x_2, y_2)$: $D = \sqrt{(x_2 - x_1)^2 + (y_2 - y_1)^2}$.
How does the distance formula relate to the Pythagorean Theorem?
The distance formula is essentially the Pythagorean Theorem ($a^2 + b^2 = c^2$) applied to a coordinate grid. The distance $D$ acts as the hypotenuse ($c$), while the horizontal difference $(\Delta x)$ and vertical difference $(\Delta y)$ act as the legs ($a$ and $b$). In 3D, a third leg $(\Delta z)$ is added.
What is the difference between Euclidean and Geodesic distance?
Euclidean distance (calculated here) is the straight-line distance in an ideal, flat coordinate system. Geodesic distance is the shortest path between two points on a curved surface (like the surface of the Earth), often calculated using the 'Great Circle Distance' formula for maximum accuracy.
Can the distance calculator handle negative coordinates?
Yes, the formula correctly handles negative coordinates because the differences are squared, which always results in a positive contribution to the total distance.