Distance Between Two Points Calculator

Use the distance calculator below to find the distance between two points. The calculator supports two-dimensional points, three-dimensional points, and lat/long coordinates.

Find Distance Between:
Point #1 Coordinates:
Point #2 Coordinates:
Point #1 Coordinates:
Point #2 Coordinates:
Point #1 Coordinates:
Point #2 Coordinates:

Distance:

6.7082

Steps to Calculate Distance

Start with the distance formula:

d=\sqrt{\left ( x_{2}-x_{1} \right ) ^{2} + \left ( y_{2}-y_{1} \right ) ^{2}}

Substitute point values and solve:

d=\sqrt{\left ( 7-1 \right ) ^{2} + \left ( 6-3 \right ) ^{2}}
d=\sqrt{\left ( 6 \right ) ^{2} + \left ( 3 \right ) ^{2}}
d=\sqrt{45}
d=6.7082

Line Graph:

Learn how we calculated this below

scroll down


On this page:


How to Calculate the Distance Between Two Points

Distance is defined as the amount of separation between two points, lines, surfaces, or objects.[1] Put more simply, distance is the length of a line connecting two points.

Distance is a length measurement that may be unitless, such as when working with points on a cartesian plane. But, it may also be measured in length units (e.g. kilometers), such as when measuring the distance between latitude and longitude coordinates.

The method to calculate the distance between points varies, depending on the type of points and how they’re measured. Regardless of the type of points, there’s a formula you can use to calculate the distance between them.

How to Calculate the Distance Between 2D Points

If you’re given a set of two-dimensional points in the form (x1, y1) and (x2, y2), you can calculate the distance between the points using the following formula:

d=\sqrt{\left ( x_{2}-x_{1} \right ) ^{2} + \left ( y_{2}-y_{1} \right ) ^{2}}

Here, the distance d is equal to the square root of the sum of the squares of the differences between the x and y values. You can use this method to calculate the distance between endpoints of a line segment or between an endpoint and the midpoint.

Graphic showing the formula to calculate the distance between points

How to Calculate the Distance Between 3D Points

If you’re given a set of three-dimensional points in the form (x1, y1, z1) and (x2, y2, z2), you can calculate the distance between the points using a similar formula:

d=\sqrt{\left ( x_{2}-x_{1} \right ) ^{2} + \left ( y_{2}-y_{1} \right ) ^{2} + \left ( z_{2}-z_{1} \right ) ^{2}}

Thus, the distance d is equal to the square root of the sum of the sum of squares of the differences between the x, y, and z values. This formula is nearly the same as the one used to calculate the distance between two-dimensional points.

Using this method, you can calculate the magnitude of a vector if you know the start and end points.

Generally, you can calculate the distance between points in any dimension by continuously adding the square of the difference of the points in each dimension to the formula.

How to Calculate the Distance Between Latitude and Longitude Coordinates

When working with coordinates on a map composed of latitudes and longitudes, you’ll need to account for the fact that these points fall on a sphere rather than a plane. The desired distance is the shortest space between the two points about the surface of the sphere rather than directly between them in three-dimensional space.

Given this, you’ll need to use trigonometry to account for the curvature of the Earth’s surface when making the calculation.

Haversine Formula

To calculate the distance between two points on Earth, you’ll need to use the haversine formula, which states:[2]

d=2rsin^{-1} \left ( \sqrt{sin^{2} \left ( \frac{\phi_{2}-\phi_{1}}{2} \right ) +cos(\phi_{1})cos(\phi_{2})sin^{2} \left ( \frac{\lambda_{2}-\lambda_{1}}{2} \right ) } \right )
[formula may scroll beyond screen]

Where:
r = radius of the Earth (6371 km)
φ1 = latitude of point 1
φ2 = latitude of point 2
λ1 = longitude of point 1
λ2 = longitude of point 2

The resulting distance d is the distance in kilometers between the two points. Because the Earth is not perfectly spherical, the results have a margin of error potentially up to 0.5%.

You can use our sine and cosine calculators to help solve this equation.

Frequently Asked Questions

How do you calculate the distance between two points on a real line?

Since a real line is a one-dimensional object, the distance between two points uses a variation of the formula for the distance between two points shown above. The formula to calculate the distance between two points on a real line, a and b, is d = |b – a|.

Let’s use the formula above to see how this formula is derived. Starting with the formula above:

d=\sqrt{\left ( b – a \right ) ^{2}}

Since there is only a single dimension, the square of the difference is the only information needed under the radical. This can be further simplified to:

d=\left | b – a \right |

So, that’s why the formula d = |b – a| is used for the distance between points on a one-dimensional line.

What is the distance between the points (3, 2) and (4, 5)?

To find the distance between the points (3, 2) and (4, 5), start with the distance formula above, substitute the values, and solve.

d=\sqrt{\left ( 4-3 \right ) ^{2} + \left ( 5-2 \right ) ^{2}}

d=\sqrt{\left ( 1 \right ) ^{2} + \left ( 3 \right ) ^{2}}

d=\sqrt{1 + 9}

d=\sqrt{10} = 3.16

So, the distance between the points (3, 2) and (4, 5) is 3.16.

How to find the distance of a point from the origin?

Since the origin lies at the point (0, 0), you can find the distance from a point to the origin by entering the coordinates for the point and the coordinates for the origin into the distance formula and solving.

So, the formula to calculate the distance from a point to the origin becomes:

d=\sqrt{\left ( x_{2}-0 \right ) ^{2} + \left ( y_{2}-0 \right ) ^{2}}

d=\sqrt{x^{2} + y^{2}}

The distance from a point to the origin is equal to the square root of the point’s x coordinate squared plus the y coordinate squared.

The line connecting the origin to the point forms the hypotenuse of a right triangle, the x-axis forms one side, and the line connecting the point to the x-axis forms the other side. So, the formula to calculate the distance from the point to the origin is the same formula used to calculate the length of a right triangle’s hypotenuse.

Great job if you noticed that the formula above looked strikingly similar to the Pythagorean theorem because these formulas are one and the same!

References

  1. Merriam-Webster, distance, https://www.merriam-webster.com/dictionary/distance
  2. Van Brummelen, G., Heavenly Mathematics: The Forgotten Art of Spherical Trigonometry, Princeton University Press, 161-164. https://books.google.com/books?id=0BCCz8Sx5wkC