Worked example: Distance Calculator
3-4-5. This fixed reference example shows one complete scenario; the interactive results above use your current inputs.
View the example inputs
- Distance model
- 2D Cartesian coordinates
- X coordinate of point 1
- 0
- Y coordinate of point 1
- 0
- X coordinate of point 2
- 3
- Y coordinate of point 2
- 4
| Calculated quantity | Example result |
|---|---|
| Straight-line distance | 5 coordinate units |
| Slope | 1.33333333 |
| Midpoint | (1.5, 2) |
Distance Calculator: choose the geometry before measuring the gap
How do I find the distance between two points?
On a flat Cartesian plane, subtract corresponding coordinates: Δx = x₂ − x₁ and Δy = y₂ − y₁. The distance is √(Δx² + Δy²). From (−1, 2) to (5, 10), the changes are 6 and 8, so the distance is √(36 + 64) = 10 coordinate units.
The Distance Calculator draws the straight segment and its horizontal and vertical components using the same scale on both axes. The two dashed legs are calculation aids; adding their lengths would describe an axis-aligned route rather than the direct segment.
How is 3D distance different from 2D distance?
A third coordinate adds another perpendicular component: distance = √(Δx² + Δy² + Δz²). From (0, 0, 0) to (2, 3, 6), the squared changes sum to 4 + 9 + 36 = 49, giving a distance of 7.
All three coordinates must share a length unit and a compatible coordinate system. The compact 3D preview shows the XY projection and labels Δz separately; it is not a perspective survey. The full component table contains the three changes used in the actual distance.
How do I find the midpoint and points along a segment?
Average each coordinate pair to locate the midpoint. For (−1, 2) and (5, 10), the midpoint is (2, 6). It lies halfway along the straight segment, not necessarily halfway along a travel route.
More generally, a fraction f of the segment has coordinates (1 − f)P₁ + fP₂. The landmark table evaluates f = 0, 0.25, 0.5, 0.75 and 1. Reversing endpoints preserves total distance while reversing the signed changes and the direction along the landmark sequence.
How do I calculate distance from latitude and longitude?
Latitude and longitude are angles on a curved surface, not Cartesian lengths. Geographic mode finds the shorter central angle between the two directions and multiplies by the explicit model radius, 6371 km. It reports the same surface length in kilometers, statute miles and nautical miles.
For two equatorial points separated by one degree of longitude, this sphere gives 6371 × π/180, about 111.194927 km. A chord would pass through the sphere and is a different length. The tool handles the date line by using the shorter angular separation.
Can I use degrees, minutes and seconds?
Yes. Enter decimal degrees such as −73.9856, or DMS with a hemisphere such as 73:59:8W. One degree contains 60 minutes, and one minute contains 60 seconds. A DMS value d:m:s becomes d + m/60 + s/3600 in magnitude.
Use N/S for latitude and E/W for longitude. Decimal south and west coordinates are negative; DMS uses its hemisphere instead of combining a sign with a direction. Minutes and seconds must be below 60, latitude within 90 degrees and longitude within 180 degrees. These checks prevent ambiguous coordinate entry.
When should I use this Distance Calculator?
Use Cartesian modes for coordinate geometry, a spatial diagonal or a straight separation in a common measured frame. Use geographic mode for a spherical surface estimate between angular coordinates. Neither mode determines driving distance, walking access, travel time or a route around obstacles.
The geographic model is deliberately spherical. Ellipsoidal geodesic tools can produce different results because Earth is not a perfect sphere; extra displayed decimals do not remove that model difference. Elevation and terrain are excluded. For high-accuracy surveying or navigation, use an appropriate geodetic model and verified source coordinates.
Formula and calculation method
Cartesian distance is √(Δx² + Δy²), or √(Δx² + Δy² + Δz²) in three dimensions. Reversing endpoints does not change distance.
A midpoint averages corresponding coordinates. Coordinate changes retain signs; distance is always nonnegative. Slope is shown for the 2D projection only.
Geographic mode computes the central angle from spherical unit vectors, using atan2(|u×v|, u·v). Surface distance = 6371 km × angle in radians.
Latitude is −90…90°, longitude −180…180°. DMS values use N/S for latitude and E/W for longitude. The shorter spherical arc handles the date line.
Scope and Limitations
- The Earth is modeled as a sphere of radius 6371 km, not an ellipsoid. Geographic results differ from ellipsoidal calculators and exclude elevation, roads, travel restrictions and route planning. The 3D drawing is schematic, not an orthographic survey.
Reference Sources
Frequently asked questions
Does swapping the two points change distance?
No. It reverses the signed coordinate changes but preserves the Euclidean or shorter spherical surface distance.
Why not add the horizontal and vertical changes?
That gives an axis-aligned path length. The straight-line distance follows the square-root-of-squares formula.
Does the geographic result match an ellipsoidal calculator?
Not necessarily. This tool uses a sphere of radius 6371 km; an ellipsoidal model describes a different surface.
Is latitude/longitude distance the driving distance?
No. It is the shorter arc on the model sphere and does not follow roads or account for access.
What does a vertical-line slope mean?
A vertical segment has undefined slope because its horizontal change is zero. Its distance can still be calculated.