On This Page
- Distance formula between two points
- Speed, distance, and time
- As the crow flies distance and flight distance
- How to calculate distance on Google Maps
- Walking and running distance
- How to calculate lightning distance
- Pupillary distance, TV viewing distance, and stopping distance
- Worked examples
- Frequently asked questions
Distance Formula Between Two Points
All versions of the distance formula come from the Pythagorean theorem, the distance is the hypotenuse of the right triangle formed by the coordinate differences. Squaring each coordinate difference means negative values do not affect the result: (−6)² = 36, same as 6².
2D distance formula (Euclidean distance)
The standard formula for two points on a flat coordinate plane. Also called the Euclidean distance formula: the ordinary straight-line distance in 2D space. Most algebra and geometry homework uses this version. If a coordinate includes a negative sign, subtract first and then square: for points (−3, 4) and (5, −2), Δx = 5 − (−3) = 8 and Δy = −2 − 4 = −6, so d = √(64 + 36) = 10. The same two points also define a line, if you need the slope, angle, and line equation alongside the distance, the Slope Calculator computes all of those from the same coordinate inputs. For a quick refresher on reading whether that slope is rising or falling, see positive vs negative slope.
3D distance formula
The 3D version adds the z-coordinate difference. Use this for points in three-dimensional space, physics problems, 3D vectors, computer graphics, or any problem where height or depth is a separate dimension. If the points do not include z-coordinates, use the 2D formula; adding a z-value of 0 gives the same result.
Latitude and longitude distance (Haversine formula)
For real-world Earth coordinates, the flat-plane formula is not accurate because Earth is curved. This calculator uses the Haversine formula to find the great-circle distance, the shortest path along Earth's surface between two coordinate pairs. Enter decimal degrees (positive for North/East, negative for South/West). The result in kilometers or miles is the air distance between those two locations, often called "as the crow flies" distance. Lat/Long mode gives straight-line great-circle distance, not driving distance, walking routes, or turn-by-turn directions.
Speed, Distance, and Time
When a problem gives a speed (rate) and a time period rather than two coordinate points, use the speed-distance-time triangle. All three versions come from the same relationship:
Always match units before calculating. If speed is in miles per hour, time must be in hours. If speed is in km/h, time must be in hours too. Convert minutes to hours by dividing by 60.
How to Find Distance From Speed and Time
Multiply speed by time. A car travelling at 60 mph for 2.5 hours covers 60 × 2.5 = 150 miles.
How to Find Time From Speed and Distance
Divide distance by speed. To drive 240 km at 80 km/h: 240 ÷ 80 = 3 hours.
How to Find Speed From Distance and Time
Divide distance by time. A runner covers 10 km in 50 minutes (0.833 hours): 10 ÷ 0.833 ≈ 12 km/h.
How to Calculate MPH From Distance and Time
MPH = miles ÷ hours. If a journey covers 180 miles in 3 hours: 180 ÷ 3 = 60 mph. Convert minutes to hours first, 45 minutes = 0.75 hours.
| Find | Formula | Example |
|---|---|---|
| Distance | D = S × T | 60 mph × 2 h = 120 miles |
| Speed | S = D ÷ T | 150 km ÷ 2.5 h = 60 km/h |
| Time | T = D ÷ S | 200 km ÷ 80 km/h = 2.5 h |
As the Crow Flies Distance and Flight Distance
As the crow flies means the shortest straight-line distance between two locations on Earth's surface, ignoring all roads, terrain, and obstacles. Use Lat/Long mode above to calculate this.
This is also the basis for flight distance estimates. A commercial flight from New York (40.71°N, 74.01°W) to London (51.51°N, 0.13°W) follows roughly the great-circle path, and the Haversine formula used here gives a close approximation of the route length.
Air distance and actual flight distance can differ slightly because planes avoid restricted airspace and adjust for wind. But as a quick air flight distance calculator, the lat/long mode here gives a reliable estimate. For airport-to-airport distances with estimated flight time, CO₂ per passenger, and timezone difference built in, use the Flight Distance Calculator.
Distance between cities
To find the approximate distance between two cities, look up the decimal latitude and longitude of each city and enter them in Lat/Long mode. For example:
- New York City: 40.7128, −74.0060
- Los Angeles: 34.0522, −118.2437
- London: 51.5074, −0.1278
- Sydney: −33.8688, 151.2093
The result is the straight-line great-circle distance in km or miles.
How to Calculate Distance on Google Maps
This calculator gives mathematical point-to-point distance, not Google Maps distance. Here is how the two differ:
- This calculator (Lat/Long mode): Straight-line great-circle distance, the shortest path through the air between two points. No roads, no routes.
- Google Maps distance: Follows actual roads, paths, and routes. Always longer than straight-line distance. Includes real-time traffic, road types, and turn-by-turn directions.
To measure distance in Google Maps: right-click a starting point and choose "Measure distance," then click the destination. Google Maps draws a straight line and shows the distance, this is the same as what Lat/Long mode here returns.
For driving or walking distance with routes, use Google Maps or a navigation app directly. Use this calculator for the coordinate-geometry straight-line answer.
Walking and Running Distance
For a walk or run between two mapped points, the coordinate formula gives the straight-line distance. Actual walking or running distance along a road, trail, or path is usually longer because you follow the route, not a straight line.
Common use cases:
- Speed-based distance: Walking speed averages about 3–4 mph. At 3.5 mph for 45 minutes (0.75 h): D = 3.5 × 0.75 = 2.625 miles.
- Running pace: A 10-minute mile pace over 30 minutes covers 3 miles. Use D = Speed × Time with speed in miles per hour (6 mph for a 10-min mile).
- Coordinate distance: If start and end GPS coordinates are known, use Lat/Long mode for the straight-line distance between those two points.
How to Calculate Lightning Distance
Sound travels much slower than light, so the gap between seeing lightning and hearing thunder tells you how far away the strike was.
This works because sound travels approximately 1 mile every 5 seconds (343 m/s). If you count 10 seconds between the flash and the thunderclap, the lightning struck about 10 ÷ 5 = 2 miles away, or 10 ÷ 3 ≈ 3.3 km.
Pupillary Distance, TV Viewing Distance, and Stopping Distance
Several common "distance calculator" searches involve measurements this tool does not handle. Here is what each one means:
Pupillary Distance (PD)
Pupillary distance is the distance in millimeters between the centers of your pupils, used to fit eyeglass lenses. It is a physical measurement taken with a ruler or PD meter, not a coordinate calculation. To measure it yourself, stand 8 inches from a mirror with a millimeter ruler held against your brow, close your right eye, and align the 0 mm mark with your left pupil, then open your right eye and close your left to read the value at the right pupil.
TV Viewing Distance
Recommended TV viewing distance depends on screen size and resolution. A common guideline for 4K TVs is a viewing distance of 1–1.5× the screen's diagonal measurement. For a 65-inch TV: 65 × 1.2 ≈ 78 inches (about 6.5 feet).
Stopping Distance
Vehicle stopping distance is thinking distance plus braking distance. At 60 mph on dry roads, the UK Highway Code gives a stopping distance of about 240 feet (73 m). It depends on speed squared, so doubling speed roughly quadruples stopping distance.
Worked Examples
Example 1: Distance Between Two Points on a Coordinate Plane
Problem: A student plots two points on graph paper: A(1, 2) and B(7, 6). Find the straight-line distance from A to B.
- Δx = 7 - 1 = 6.
- Δy = 6 - 2 = 4.
- d = √(6² + 4²) = √52 = 7.2111.
Answer: The distance is about 7.2111 units.
Example 2: 3D Distance Between Two Points
Problem: A drone moves from (1, 2, 3) to (4, 6, 9) in a 3D coordinate model. Estimate the direct distance between the starting point and ending point.
- Δx = 3, Δy = 4, and Δz = 6.
- d = √(3² + 4² + 6²).
- d = √61 = 7.8102.
Answer: The 3D distance is about 7.8102 units.
Example 3: Latitude and Longitude Distance Between Cities
Problem: Estimate the distance from New York City to Los Angeles using latitude and longitude, not driving directions.
- Enter New York as 40.7128, -74.0060.
- Enter Los Angeles as 34.0522, -118.2437.
- Choose kilometers or miles for the Earth distance unit.
Answer: The calculator estimates the great-circle distance using the Haversine formula. This is closer to air distance than road distance.
Example 4: Distance From Speed and Time
Problem: A runner keeps an average speed of 8 miles per hour for 45 minutes. How far did the runner travel?
- Convert 45 minutes to hours: 45 ÷ 60 = 0.75 hours.
- Use distance = speed × time.
- Distance = 8 × 0.75 = 6 miles.
Answer: The runner traveled 6 miles. This is a speed-time distance problem, not a coordinate-distance problem.
Example 5: Negative Coordinates
Problem: Find the distance between (-3, 4) and (5, -2).
- Δx = 5 - (-3) = 8.
- Δy = -2 - 4 = -6.
- d = √(8² + (-6)²) = √100 = 10.
Answer: The distance is 10 units. Squaring the coordinate differences is why the negative sign does not make the distance negative.
Frequently Asked Questions
What is the distance formula and how do you use it?
In 2D: d = √((x2 − x1)² + (y2 − y1)²). In 3D, add (z2 − z1)² inside the square root. Both extend the Pythagorean theorem, distance is the hypotenuse of the right triangle formed by the coordinate differences. Subtract coordinates first, then square: for points (−3, 4) and (5, −2), Δx = 8, Δy = −6, d = √(64 + 36) = 10.
How do you calculate distance from speed and time?
Use Distance = Speed × Time. Make sure units match, if speed is in mph, time must be in hours. Convert minutes to hours by dividing by 60. For example: 55 mph × 3 hours = 165 miles; 8 mph × 0.75 hours (45 min) = 6 miles.
How do you calculate time from speed and distance?
Use Time = Distance ÷ Speed. To travel 300 km at 100 km/h: 300 ÷ 100 = 3 hours.
How do you calculate speed (or mph) from distance and time?
Speed = Distance ÷ Time. A cyclist covering 45 miles in 3 hours averaged 15 mph. Convert any non-hour time unit to hours first, 90 minutes = 1.5 hours, so a 90-mile journey in 90 minutes = 90 ÷ 1.5 = 60 mph.
How do you measure distance on Google Maps, and how does it differ from driving distance?
Right-click your starting point in Google Maps, choose "Measure distance," then click the destination, Google Maps draws a straight line and shows the distance. That straight-line result matches what Lat/Long mode here returns. For driving distance, use "Get directions" instead: it follows actual roads and is always equal to or longer than straight-line distance.
How do you calculate lightning distance?
Count the seconds between the lightning flash and the thunder, then divide by 5 for miles (or by 3 for kilometers). Sound travels about 1 mile every 5 seconds. Ten seconds = roughly 2 miles away.
How do you calculate pupillary distance?
Pupillary distance (PD) is a physical measurement of the gap between your pupils in millimeters, not a coordinate calculation. Stand 8 inches from a mirror, hold a mm ruler against your brow, close your right eye, align 0 mm with your left pupil center, then read the value at your right pupil center. A typical adult PD ranges from 54 to 74 mm.
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.