Distance Calculator

Straight-line distance

5 coordinate units

Slope

1.33333333

All results
Calculator inputs
?

Cartesian distance uses matching length units. Geographic mode uses a sphere of radius 6371 km; it is not a driving route or an ellipsoidal geodesic.

?

Signed Cartesian coordinate. Both points and every axis must use the same length unit.

?

Signed Cartesian coordinate. Both points and every axis must use the same length unit.

?

Signed Cartesian coordinate. Both points and every axis must use the same length unit.

?

Signed Cartesian coordinate. Both points and every axis must use the same length unit.

A straight segment joins the points

Coordinate differences and squared components

Square each signed change, add the squared components, then take the square root. Midpoint coordinates are the averages of the two endpoints.

Coordinate differences and squared components
AxisPoint 1Point 2Change ΔSquared changeMidpoint coordinate
x03391.5
y044162

Points along the straight segment

Linear interpolation stays on the straight segment. At fraction 0.5, the coordinates equal the midpoint.

Points along the straight segment
Fraction of segmentXYDistance from point 1
0000
0.250.7511.25
0.51.522.5
0.752.2533.75
1345

Distance formula examples

All coordinates within each example use matching units. Distance is not the sum of absolute axis changes.

Distance formula examples
EndpointsSum of squared changesDistance
(0, 0) to (6, 8)36 + 64 = 10010
(−2, 1) to (−2, 6)0 + 25 = 255
(0, 0, 0) to (2, 3, 6)4 + 9 + 36 = 497

How to use the Distance Calculator

Find 2D or 3D straight-line distance, coordinate changes and midpoints. Estimate spherical great-circle distance from decimal or DMS coordinates with clear model limits.

  1. 1. Enter your inputs

    Start with Distance model, X coordinate of point 1, Y coordinate of point 1, X coordinate of point 2. Use the units shown beside each field and open the field help when you need its assumptions.

  2. 2. Read the results

    Results update as you enter valid values. Review Straight-line distance, Slope, Midpoint. Keep the entered units and settings consistent when comparing scenarios.

  3. 3. Check the calculation

    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.

    See the worked example and method

Understanding the Distance Calculator: uses, inputs and results

The Distance Calculator finds straight-line separation between two points in a Cartesian plane.

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.

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.

Further reading: OpenStax: coordinate distance and midpoint · MIT OpenCourseWare: great-circle distance on a sphere

What do the Distance Calculator inputs mean?

Distance model
Cartesian distance uses matching length units. Geographic mode uses a sphere of radius 6371 km; it is not a driving route or an ellipsoidal geodesic.
X coordinate of point 1
Signed Cartesian coordinate. Both points and every axis must use the same length unit. This field applies when Distance model is set to 2D Cartesian coordinates or 3D Cartesian coordinates.
Y coordinate of point 1
Signed Cartesian coordinate. Both points and every axis must use the same length unit. This field applies when Distance model is set to 2D Cartesian coordinates or 3D Cartesian coordinates.
X coordinate of point 2
Signed Cartesian coordinate. Both points and every axis must use the same length unit. This field applies when Distance model is set to 2D Cartesian coordinates or 3D Cartesian coordinates.
Y coordinate of point 2
Signed Cartesian coordinate. Both points and every axis must use the same length unit. This field applies when Distance model is set to 2D Cartesian coordinates or 3D Cartesian coordinates.
Z coordinate of point 1
Signed Cartesian coordinate. Both points and every axis must use the same length unit. This field applies when Distance model is set to 3D Cartesian coordinates.
Z coordinate of point 2
Signed Cartesian coordinate. Both points and every axis must use the same length unit. This field applies when Distance model is set to 3D Cartesian coordinates.
Latitude of point 1
Decimal degrees, or DMS with a hemisphere: 40:26:46N or 73:59:8W. Decimal south/west values are negative; minutes and seconds must be below 60. This field applies when Distance model is set to Latitude / longitude: spherical Earth.
Longitude of point 1
Decimal degrees, or DMS with a hemisphere: 40:26:46N or 73:59:8W. Decimal south/west values are negative; minutes and seconds must be below 60. This field applies when Distance model is set to Latitude / longitude: spherical Earth.
Latitude of point 2
Decimal degrees, or DMS with a hemisphere: 40:26:46N or 73:59:8W. Decimal south/west values are negative; minutes and seconds must be below 60. This field applies when Distance model is set to Latitude / longitude: spherical Earth.
Longitude of point 2
Decimal degrees, or DMS with a hemisphere: 40:26:46N or 73:59:8W. Decimal south/west values are negative; minutes and seconds must be below 60. This field applies when Distance model is set to Latitude / longitude: spherical Earth.

When is the Distance Calculator useful?

Check coordinate geometry

Enter the two x/y pairs to calculate their Euclidean distance.

Compare separation and slope

Review the slope as a related quantity. Coordinate distance is not a road route or travel-time estimate.

Distance Calculator: a practical reference

The fixed “3-4-5” example on this page produces the results below. It illustrates the stated model; your live results above use your current inputs.

Distance model
2D Cartesian coordinates
X coordinate of point 1
0
Y coordinate of point 1
0
Straight-line distance
5 coordinate units
Slope
1.33333333
Review the example inputs and calculation

Use the result in context

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.

Try the Distance Calculator·Read the subject guide·Explore a related calculator

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 results for the fixed example
Calculated quantityExample result
Straight-line distance5 coordinate units
Slope1.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.

OpenStax: coordinate distance and midpoint

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.

MIT OpenCourseWare: great-circle distance on a sphere

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.