CalculatorPro Tools

Distance Calculator

Find the distance between two points, convert distance units, or get a hypotenuse.

What Is the Distance Calculator?

Distance is the length of the straight line between two points, and it is the foundation of the Pythagorean theorem and of coordinate geometry. This calculator covers the three forms the question comes in. Given two points in a plane or in space, it finds the straight line distance, the midpoint, and the change along each axis. Given a distance in one unit, it converts exactly into all nine units at once, using the internationally agreed definitions rather than rounded conversions. Given two sides of a right angled triangle, it returns the hypotenuse together with the area and perimeter. Every unit here is defined exactly, including the international mile at precisely 1,609.344 metres, which is why conversions round trip perfectly rather than drifting by a fraction each time you convert back.

Key Statistics

  • 1,609.344 metres

    The exact length of the international mile, agreed in 1959 when the UK and US converted to the same definition. The international yard is exactly 0.9144 metres and the international foot exactly 0.3048 metres, so every imperial conversion here is a precise constant rather than an approximation.

    Source: International yard and pound agreement of 1959

  • 1,852 metres

    The exact length of a nautical mile, used in both aviation and maritime navigation. It is deliberately different from the statute mile because it is defined as one minute of arc of latitude, tying it to the geometry of the Earth rather than to any land survey.

    Source: Nautical mile, Wikipedia

  • 3,600 m per s

    One nautical mile expressed per hour is one knot, so a vessel doing 20 knots covers exactly 20 nautical miles per hour. Navigation speeds are quoted in knots precisely because a nautical mile is tied to the Earth's curvature, which makes distance over a charted route directly meaningful.

    Source: Knot, Wikipedia

The Formula

Distance between two points is the square root of the sum of the squared differences along each axis. In two dimensions the distance equals the square root of (x2 minus x1) squared plus (y2 minus y1) squared. In three dimensions a third term is added for the change in z. This is the Pythagorean theorem applied to the axis-aligned right triangle formed by the two points.

Worked Examples

The distance from the point 0, 0 to the point 3, 4. The horizontal change is 3 minus 0, which is 3, and the vertical change is 4 minus 0, which is 4. The square root of 9 plus 16 is the square root of 25, which is exactly 5.

The 3, 4, 5 right triangle

  1. Take point A at 0, 0 and point B at 3, 4.
  2. Find the horizontal change: 3 minus 0 equals 3.
  3. Find the vertical change: 4 minus 0 equals 4.
  4. Square and add: 9 plus 16 equals 25.
  5. Take the square root: the square root of 25 is exactly 5.

Distance: 5

Distance in three dimensions

  1. Take point A at 0, 0, 0 and point B at 2, 3, 6.
  2. The changes are 2, 3 and 6 along the three axes.
  3. Square each: 4, 9 and 36.
  4. Add them: 4 plus 9 plus 36 equals 49.
  5. The square root of 49 is exactly 7.

Distance: 7

Converting miles to kilometres

  1. One international mile is exactly 1,609.344 metres.
  2. One kilometre is exactly 1,000 metres.
  3. Divide: 1,609.344 divided by 1,000 equals 1.609344.
  4. So one mile is exactly 1.609344 kilometres, not approximately 1.6.

1 mile = 1.609344 km exactly

Hypotenuse of a right triangle

  1. Take a right triangle with legs of 5 and 12.
  2. Square each leg: 25 and 144.
  3. Add them: 169.
  4. The square root of 169 is exactly 13.
  5. The area is also 5 multiplied by 12 divided by 2, which is 30.

Hypotenuse 13, area 30

Real World Use Cases

Mapping and navigation

Distance between two coordinates is the core calculation behind mapping applications, route planning and delivery dispatch. Knowing the straight line distance tells you whether a journey is worth making and how it compares with the actual travelled route.

Computer graphics and game development

Distance drives collision detection, camera zoom, level of detail and pathfinding. Graphics code almost always works in 2D or 3D space with the same formula used here.

Construction and surveying

Setting out a site needs the horizontal and vertical differences between points, which is exactly what the axis change figures report alongside the straight line distance.

Science and measurement

Experimental error analysis compares a measured value against a reference, and mixed unit datasets need exact conversion before any arithmetic. Both depend on conversions that do not drift.

Expert Tips

  • ✓ Use exact unit definitions rather than the 1.6 kilometres per mile approximation. The 0.6 percent error compounds quickly across a chain of conversions.
  • ✓ Square the differences before adding them. A common slip is adding the differences and then squaring, which gives a completely different and wrong answer.
  • ✓ Round only at the end. Squared and summed terms accumulate intermediate error, so carrying full precision through gives a materially better final figure.
  • ✓ For real world overland distance, the straight line is a lower bound. Roads, terrain and obstacles always make the travelled distance longer.
  • ✓ Distance in three dimensions is not the same as distance projected onto a plane. Check which quantity your problem actually needs before including the z term.

Frequently Asked Questions

How do I calculate the distance between two points? ▼

Subtract the coordinates of one point from the other along each axis, square each difference, add them together and take the square root. For 0,0 to 3,4 that is the square root of 9 plus 16, which is exactly 5.

How do I convert miles to kilometres? ▼

One international mile is exactly 1,609.344 metres and one kilometre is exactly 1,000 metres, so one mile is exactly 1.609344 kilometres. Using the familiar 1.6 figure introduces a 0.58 percent error.

How many feet are in a mile? ▼

Exactly 5,280 feet, since a mile is exactly 1,609.344 metres and a foot is exactly 0.3048 metres. A yard is exactly 3 feet and an inch is exactly one twelfth of a foot.

What is a nautical mile? ▼

Exactly 1,852 metres, tied to one minute of arc of latitude rather than to any land survey. It is deliberately different from the statute mile, and it is why navigation speeds are quoted in knots, one nautical mile per hour.

How do I calculate a hypotenuse? ▼

Square both legs, add them and take the square root. Legs of 5 and 12 give the square root of 25 plus 144, which is the square root of 169, which is exactly 13.

Does the calculator work in 3D? ▼

Yes. Switch the dimensions selector to 3D and the z coordinate is included as a third squared term. The calculator also reports the change along each axis separately so you can see which contributes most.

What is the midpoint between two points? ▼

Average each coordinate independently. The midpoint of 0,0 and 10,20 is 5,10, found by adding the two x values, dividing by two, and doing the same for y.

Is straight line distance the same as travel distance? ▼

No. The straight line is a lower bound. Roads, rivers, buildings and terrain always add distance, sometimes considerably. Use the straight line to compare relative positions rather than to estimate a journey.

Why do my conversions drift slightly? ▼

Usually because a rounded conversion factor was used, such as 1 mile as 1.6 kilometres. Every unit here is an exact defined constant, so converting there and back returns the original value exactly.

Can this calculate distance on a sphere? ▼

Not directly. This calculates straight line distance in flat Cartesian space, which is correct for buildings, plans, screens and small areas. For long distances on the Earth's curved surface a haversine or great circle calculation is needed instead.

Common Mistakes to Avoid

  • ⚠ Adding the horizontal and vertical changes instead of squaring them first, which gives a sum rather than a distance.
  • ⚠ Taking the square root of only one term and forgetting the other.
  • ⚠ Using the rounded 1.6 kilometres per mile figure, which introduces a small error on every conversion.
  • ⚠ Confusing the international mile with the statute mile, which differ and are both still in use in their own contexts.
  • ⚠ Expecting a real journey between two points to match the straight line distance, ignoring roads and terrain.

Last updated: · by CalculatorPro Tools