Distance Formula Calculator
Find the distance between two points in 2D, 3D, or even on the Earth’s surface using latitude and longitude. This tool shows the formula, calculates the midpoint, and handles negative or decimal coordinates.
Point A (x₁, y₁)
Point B (x₂, y₂)
Distance formula (2D)
Formula:
d = \sqrt{(x_2 - x_1)^2 + (y_2 - y_1)^2}
This is derived from the Pythagorean theorem: the straight-line distance is the hypotenuse of a right triangle whose legs are the differences in x and y.
Distance formula (3D)
d = \sqrt{(x_2 - x_1)^2 + (y_2 - y_1)^2 + (z_2 - z_1)^2}
Haversine formula (lat/long)
d = 2R \arcsin \left(\sqrt{\sin^2\left(\frac{\varphi_2 - \varphi_1}{2}\right) + \cos(\varphi_1)\cos(\varphi_2)\sin^2\left(\frac{\lambda_2 - \lambda_1}{2}\right)}\right)
Where φ is latitude in radians, λ is longitude in radians, and R is Earth’s radius.
FAQs
What is the midpoint between two points?
Midpoint M between (x₁, y₁) and (x₂, y₂) is: M = ((x₁ + x₂)/2, (y₁ + y₂)/2). Our tool shows it for 2D/3D.
Can I use this for physics problems?
Yes. If your problem involves straight-line distance between two points in Cartesian space, this formula is standard.
What if I only have one coordinate different?
The formula still works — the other difference will be zero, so it reduces to the absolute difference on one axis.