Distance Calculator Between Two Points: 2D & 3D
Find the straight-line distance between two points on a Cartesian plane or in three-dimensional space. Enter coordinates using one consistent unit and scale on all axes. Results include the coordinate differences and midpoint.
Distance between two points in 2D
For points (x1, y1) and (x2, y2), distance = sqrt((x2 - x1)^2 + (y2 - y1)^2). The squared coordinate differences are the legs of a right triangle, and the straight-line distance is its hypotenuse.
Select 2D (x, y), then enter x1 = 1, y1 = 2, x2 = 4 and y2 = 6. The differences are (3, 4), giving sqrt(9 + 16) = 5 coordinate units. The midpoint is (2.5, 4).
Distance in three dimensions
For 3D coordinates, add the third squared difference: distance = sqrt((x2 - x1)^2 + (y2 - y1)^2 + (z2 - z1)^2). From (0, 0, 0) to (2, 3, 6), the distance is sqrt(4 + 9 + 36) = 7 coordinate units.
Midpoint and direction
The midpoint averages each coordinate pair: ((x1 + x2) / 2, (y1 + y2) / 2), with (z1 + z2) / 2 added in 3D. Coordinate differences preserve direction from Point 1 to Point 2. Distance is nonnegative, remains unchanged when points are swapped, and is zero for identical points.
Use consistent axes and units
If every axis uses meters, distance is in meters. Do not mix feet and meters or use axes with different scales without converting first. Latitude and longitude are angular coordinates on the Earth, so this Cartesian formula does not give a geographic distance in miles or kilometers. Road distances and paths around obstacles are also outside this calculator.
Limits and rounding
Coordinates may be negative, zero or positive, from -1000000000 to 1000000000, with up to six decimal places. Use ordinary decimal notation. Displayed values round to at most six decimal places; nonzero magnitudes below 0.000001 appear as a threshold instead of zero. Calculations use unrounded values internally. Inputs are approximate browser numbers, not symbolic algebra or survey-grade measurements.
Privacy
This calculator runs locally and does not save or transmit coordinate entries. The hosting website may use separate analytics or advertising services under its privacy policy.
Comments
Post a Comment