# 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:**

## Distance:

### Steps to Calculate Distance

#### Start with the distance formula:

#### Substitute point values and solve:

### Line Graph:

### Steps to Calculate Distance

miles | |

kilometers |

### Steps to Calculate Distance

## 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 *(x _{1}, y_{1})* and

*(x*, you can calculate the distance between the points using the following formula:

_{2}, y_{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.

### How to Calculate the Distance Between 3D Points

If you’re given a set of three-dimensional points in the form *(x _{1}, y_{1}, z_{1})* and

*(x*, you can calculate the distance between the points using a similar formula:

_{2}, y_{2}, z_{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]}

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:

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:

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.

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:

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

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