Distance Tool
Find distances in two-dimensional and three-dimensional space using Euclidean, Manhattan or Chebyshev metrics. Measure great-circle distances between geographic coordinates or the shortest distance from a point to a line, segment or ray, with visual diagrams and detailed results.
Great-circle distance on a spherical Earth, not road or travel distance.
Coordinates and results use the same selected unit.
Table of Contents
Highlights
- 2D and 3D point-to-point distance calculations
- Euclidean, Manhattan and Chebyshev distance options
- Great-circle distances with bearings and Earth radius choices
- Shortest distance to infinite lines, segments and rays
- Interactive coordinate diagram, detailed breakdowns and CSV, JSON, SVG or PNG exports
How Distance Tool Works?
For two points, subtract corresponding coordinates to obtain the differences along each axis. In two dimensions, the Euclidean distance follows Pythagoras; in three dimensions, it includes the difference in height or depth.
In the two-dimensional case, omit the z term. Two alternative distance measures are Manhattan distance, which adds absolute coordinate differences, and Chebyshev distance, which takes the largest absolute difference.
| Metric | How distance is measured |
|---|---|
| Euclidean | Square root of the sum of squared axis differences |
| Manhattan | Sum of absolute axis differences |
| Chebyshev | Largest absolute axis difference |
For two latitude–longitude positions, the haversine formula finds the central angle between them on a spherical Earth. Great-circle distance equals that angle, in radians, multiplied by the selected Earth radius (mean, equatorial or polar). The results also include initial and final bearings and the central angle.
For point-to-line distance, project point P onto the direction from A to B to find the nearest point Q, then measure the Euclidean distance from P to Q. The projection is unrestricted for an infinite line, limited to the interval from A to B for a segment, or restricted to the forward direction for a ray. The output includes Q, the projection factor and the reference segment length.
Practical Use Cases
Students and teachers: Explore coordinate geometry, midpoint, slope and direction while comparing straight-line, Manhattan and Chebyshev distances in two or three dimensions.
CAD designers and engineers: Check spatial separation between specified 3D points and measure the shortest distance from a point to an infinite line, finite segment or ray.
GIS analysts and geography students: Estimate great-circle distances and initial or final bearings between latitude–longitude locations using a selected spherical Earth radius.
Game developers: Compare Euclidean, Manhattan and Chebyshev distances for movement rules, proximity checks and grid-based path heuristics.
Surveying and drawing users: Locate the nearest point on a drawn line or segment and inspect the projection factor to see whether the closest position is within the endpoints.
Accuracy and Limitations
Coordinate calculations use JavaScript floating-point arithmetic and display 2, 3, 4, 6 or 8 decimal places, so rounding affects the shown values. Coordinate inputs are limited to magnitudes of one trillion. Geographic distances use a spherical haversine model with a selectable mean, equatorial or polar radius, not an ellipsoidal geodesic or a road route; bearings can be ambiguous at coincident or antipodal points. Point-to-line calculations require distinct endpoints A and B. The 3D diagram is an illustrative projection, and the latitude–longitude diagram does not trace the actual great-circle route on a map.