On This Page
- Pick the kind of distance
- Two points on a grid
- Distance on the Earth
- Speed, distance and time
- Everyday distance rules of thumb
- How the calculator is verified
- FAQ
Pick the Kind of Distance
| You have | Use | Formula |
|---|---|---|
| Two points (x, y) on a plane | 2D mode | d = √((x2 − x1)² + (y2 − y1)²) |
| Two points (x, y, z) in space | 3D mode | Add (z2 − z1)² inside the root |
| Two places as latitude and longitude | Lat/Long mode | Haversine great-circle formula |
| A speed and a time | Arithmetic below | Distance = speed × time |
Two Points on a Grid
The distance formula is Pythagoras: the gap is the hypotenuse of the right triangle made by the x and y differences. Subtract first, then square, so a negative difference does no harm, since (−6)² = 36.
- A(1, 2) to B(7, 6): Δx = 6, Δy = 4, so d = √52 ≈ 7.2111.
- (−3, 4) to (5, −2): Δx = 8, Δy = −6, so d = √100 = 10.
- A drone from (1, 2, 3) to (4, 6, 9): √(9 + 16 + 36) = √61 ≈ 7.8102.
The same two points define a line, and the Slope Calculator gives its slope, angle and equation. Positive vs negative slope covers reading whether it rises or falls.
Distance on the Earth
A flat-plane formula goes wrong over long distances because the Earth curves. Lat/Long mode uses the haversine formula, which gives the great-circle distance, the shortest path over the surface or "as the crow flies." Enter decimal degrees, with positive values for north and east and negative for south and west.
New York (40.7128, −74.0060) to Los Angeles (34.0522, −118.2437) comes out at about 3,936 km or 2,446 miles, and New York to London (51.5074, −0.1278) at about 5,570 km. The result treats the Earth as a perfect sphere, so it can be up to about 0.3% out. It is close to air distance, which is why flight planning starts from it; the Flight Distance Calculator adds airport lookups, flight time and CO₂. Numbers this large are also where scientific notation becomes handy.
This is not driving distance. Google Maps' "Measure distance" tool (right-click a point) draws the same straight line, but "Get directions" follows roads and is always as long or longer. Walking and running routes are longer than the straight line too.
Speed, Distance and Time
| Find | Formula | Example |
|---|---|---|
| Distance | speed × time | 60 mph for 2.5 h = 150 miles |
| Time | distance ÷ speed | 240 km at 80 km/h = 3 h |
| Speed | distance ÷ time | 180 miles in 3 h = 60 mph |
Put time in hours before multiplying: 45 minutes is 0.75 hours, so a runner at 8 mph for 45 minutes covers 6 miles. A 10 km run in 50 minutes (0.833 h) is about 12 km/h, and a 10-minute mile is 6 mph.
Everyday Distance Rules of Thumb
- Lightning: count the seconds from flash to thunder and divide by 5 for miles or by 3 for kilometers. Sound covers about a mile every 5 seconds, so 10 seconds is about 2 miles or 3.3 km.
- Walking: about 3 to 4 mph. 45 minutes at 3.5 mph is 2.625 miles.
- TV viewing: for 4K, sit about 1 to 1.5 times the screen diagonal away. 65 × 1.2 is about 78 inches, 6.5 feet.
- Stopping distance: thinking distance plus braking distance. The UK Highway Code gives about 73 m (240 ft) at 60 mph on a dry road, and because braking grows with speed squared, doubling speed roughly quadruples it.
- Pupillary distance: measured with a millimeter ruler in a mirror, not calculated. Most adults fall between 54 and 74 mm.
How the Calculator Is Verified
Switching to lat/long mode swaps in the haversine formula entirely, converting each coordinate to radians and using an Earth radius of 3958.8 miles or 6371 kilometers depending on the selected unit, a calculation with nothing in common with the other two modes. 2D and 3D actually share one function: distance = sqrt(dx² + dy² + dz²); in 2D mode the code simply sets z1 and z2 to 0 before running it, so the same formula produces both the flat and spatial result. That is why a 3D calculation with z=0 for both points always matches the 2D answer for identical x,y values.
Frequently Asked Questions
What is the difference between distance and displacement?
Distance is the total length of the path travelled, always positive. Displacement is the straight-line change in position from start to finish, with direction. Walking 3 miles east then 3 miles west gives distance = 6 miles but displacement = 0.
Is latitude-longitude distance exact?
It is a close estimate. The Haversine formula assumes a perfectly spherical Earth. Earth is slightly flattened at the poles, so real great-circle distances can differ by up to about 0.3%. For city distances and flight estimates, it is accurate enough.
References
- Distance, Wolfram MathWorld: Euclidean distance formula in 2D and n-dimensional space, derivation from the Pythagorean theorem.
- Pythagorean Theorem, Wolfram MathWorld: the geometric basis for all coordinate distance formulas.