Updated on April 17th, 2026

Distance Calculator

Created By Jehan Wadia

Point 1
Point 2
x y

Distance = 5.00
Step-by-Step Solution
d = √[(x₂ − x₁)² + (y₂ − y₁)²]
d = √[(4 − 1)² + (5 − 1)²]
d = √[(3)² + (4)²]
d = √[9 + 16]
d = √25
d = 5.00
Point 1
Point 2
x y z

Distance = 5.39
Step-by-Step Solution
Origin
Destination

5,570.2
Kilometers
3,461.0
Miles
3,007.7
Nautical Miles
Calculation Details
About the calculation methods: The primary result uses Lambert's formula on the WGS-84 ellipsoid, which accounts for Earth's oblate shape and is accurate to ~10 meters over thousands of kilometers. The Haversine formula treats Earth as a perfect sphere (R = 6,371 km), which can introduce errors up to ~0.3% but is simpler and widely used.

Introduction

The Distance Calculator helps you find the distance between two points on a coordinate plane. In geometry, we use the distance formula to measure how far apart two points are. This formula comes from the Pythagorean theorem, which you may already know from working with right triangles. All you need to do is enter the x and y coordinates of two points, and this tool will calculate the exact distance between them. It works great for homework, classwork, or anytime you need a quick and accurate answer. No more solving by hand — just plug in your numbers and get your result in seconds!

How to Use Our Distance Calculator

Enter the coordinates of two points, and this calculator will find the distance between them with a full step-by-step solution. Choose from three modes: 2D, 3D, or Geographic distance.

2D Distance Tab: Enter the X and Y coordinates for Point 1 (X₁, Y₁) and Point 2 (X₂, Y₂). The calculator uses the distance formula to find the straight-line distance between the two points on a flat plane and displays the result on a graph.

3D Distance Tab: Enter the X, Y, and Z coordinates for Point 1 (X₁, Y₁, Z₁) and Point 2 (X₂, Y₂, Z₂). The calculator finds the straight-line distance between two points in three-dimensional space and shows them on a 3D diagram.

Geographic Distance Tab: Enter the latitude and longitude of an origin and a destination to find the real-world distance between two places on Earth. You can type a city or airport name into the search bar to auto-fill the coordinates, or enter them by hand.

Decimal Degrees or DMS: In the Geographic tab, choose whether to enter coordinates as decimal degrees (e.g., 40.7128) or as degrees, minutes, and seconds (e.g., 40° 42' 46.08" N). The calculator handles both formats and keeps them in sync.

Geographic Results: The Geographic tab gives you the distance in kilometers, miles, and nautical miles. It uses Lambert's formula on the WGS-84 ellipsoid for high accuracy and also shows the Haversine result for reference, along with the difference between the two methods.

Calculate and Reset: Click the Calculate button to see your result and a full step-by-step breakdown of the math. Click Reset to return all fields to their default values.

What Is the Distance Formula?

The distance formula is a math rule that tells you how far apart two points are. It comes from the Pythagorean theorem, which says that in a right triangle, the square of the longest side (the hypotenuse) equals the sum of the squares of the other two sides. When you want to find the straight-line distance between two points, you are really finding the length of that hypotenuse.

2D Distance Formula

In two dimensions, every point has an x-coordinate and a y-coordinate. If you have Point 1 at (x₁, y₁) and Point 2 at (x₂, y₂), the distance formula is:

d = √[(x₂ − x₁)² + (y₂ − y₁)²]

You subtract the x-values to find the horizontal gap, subtract the y-values to find the vertical gap, square both gaps, add them together, and take the square root. The answer is the straight-line distance between the two points on a flat surface.

3D Distance Formula

When a third dimension is added, each point also has a z-coordinate for depth or height. The formula extends naturally by including the difference in z-values:

d = √[(x₂ − x₁)² + (y₂ − y₁)² + (z₂ − z₁)²]

This works the same way as the 2D version but accounts for the extra direction. It is useful in fields like physics, engineering, and 3D modeling where objects exist in space, not just on a flat plane.

Geographic Distance on Earth

Finding the distance between two places on Earth is more complex because Earth is not flat — it is a sphere that is slightly squished at the poles (called an oblate spheroid). Two common methods handle this:

Latitude and Longitude Formats

Geographic coordinates can be written in two ways. Decimal degrees use a single number like 40.7128° for latitude. Degrees-minutes-seconds (DMS) break it into parts, such as 40° 42' 46.08" N. Both formats describe the same location — decimal degrees are easier for calculations, while DMS is the traditional format seen on maps and in navigation.

Common Uses for Distance Calculations

Distance formulas are used every day in many areas. Students use the 2D and 3D formulas in geometry and algebra classes. Game developers use them to detect collisions and measure spacing between objects. Pilots, ship captains, and delivery companies use geographic distance to plan routes. Scientists use these formulas to track weather patterns, animal migration, and satellite orbits. No matter the scale — whether it is two dots on graph paper or two cities across an ocean — the core idea remains the same: find the straight-line gap between two known points.

Related Calculators

If you found this Distance Calculator useful, you may also want to try some of our other geometry and math tools. Use the Midpoint Calculator to find the exact center point between two coordinates, or the Slope Calculator to determine the steepness of the line connecting two points. For problems involving parabolas and equations, our Quadratic Formula Calculator can help you find roots quickly. You can also explore the Rate of Change Calculator to analyze how values shift over a given interval, the Percentage Calculator for quick ratio and proportion work, or the Percent Error Calculator to measure the accuracy of your results. For physics applications that build on distance concepts, check out the Displacement Calculator, the Projectile Motion Calculator, or the Free Fall Calculator. If you're working with areas and measurements for real-world projects, our Square Footage Calculator is a handy companion.


Frequently Asked Questions

What is the distance between two points?

The distance between two points is the length of the straight line that connects them. In 2D, you use the formula d = √[(x₂ − x₁)² + (y₂ − y₁)²]. You subtract the coordinates, square the differences, add them, and take the square root. The result is the shortest path between the two points.

Can I use negative numbers as coordinates?

Yes. This calculator works with negative numbers. Points can be in any quadrant of the coordinate plane. For example, you can find the distance between (-3, -2) and (4, 5) with no issues. Just type the negative sign before the number in the input field.

What is the difference between 2D and 3D distance?

2D distance measures how far apart two points are on a flat surface using only X and Y coordinates. 3D distance adds a Z coordinate for depth or height. The 3D formula is d = √[(x₂ − x₁)² + (y₂ − y₁)² + (z₂ − z₁)²]. Use 2D for flat problems like maps or graphs, and 3D for objects in space.

What units does the 2D or 3D distance result use?

The 2D and 3D tabs give a unitless number. The result is in whatever units your coordinates use. If your points are measured in meters, the distance is in meters. If they are in feet, the distance is in feet. The calculator does the math — you decide the unit.

What is the Haversine formula?

The Haversine formula calculates the shortest distance between two points on a sphere. It treats Earth as a perfect ball with a radius of 6,371 km. It uses latitude and longitude and applies trigonometry to find the great-circle distance. It is simple and accurate to about 0.3%.

What is Lambert's formula and why is it more accurate?

Lambert's formula (using Vincenty's method) models Earth as an oblate spheroid — a sphere that is slightly flattened at the poles. It uses the WGS-84 ellipsoid, which is the same model GPS systems use. This makes it accurate to about 10 meters, even over very long distances. That is why this calculator uses it as the primary result.

What is the difference between decimal degrees and DMS?

Decimal degrees write a location as a single number, like 40.7128°. Degrees-minutes-seconds (DMS) breaks it into parts, like 40° 42' 46.08" N. Both describe the same spot. This calculator lets you enter coordinates in either format and keeps them synced automatically.

How do I find the distance between two cities?

Go to the Geographic Distance tab. Type a city name in the search bar for the origin, then type another city name for the destination. The calculator will fill in the latitude and longitude for you. Click Calculate Distance to see the result in kilometers, miles, and nautical miles.

Can I search for airports in the Geographic tab?

Yes. The search bar recognizes many major airports by their code or name. For example, you can type "JFK," "LAX," or "Heathrow" and pick it from the list. The calculator will fill in the airport's latitude and longitude automatically.

Why are the Haversine and Lambert results slightly different?

The Haversine formula treats Earth as a perfect sphere, while Lambert's formula uses an ellipsoid that matches Earth's true shape. Earth is wider at the equator and flatter at the poles, so the sphere model introduces small errors. The difference is usually less than 0.3%, but it can add up over long distances.

What does the graph show in the 2D tab?

The graph plots your two points on a coordinate plane and draws a dashed line between them. It labels each point with its coordinates and shows the calculated distance along the line. This gives you a visual picture of where the points are and how far apart they sit.

How do I reset the calculator to its default values?

Click the Reset button next to the Calculate button on any tab. This will clear your inputs and restore the original example values. The calculator will also recalculate automatically so you can see the default result right away.

Can I find the distance between a point and the origin (0, 0)?

Yes. Set Point 1 to (0, 0) and enter your other point as Point 2. The distance formula simplifies to d = √(x² + y²), which gives you the distance from any point to the origin.

What is a nautical mile?

A nautical mile is a unit of distance used in aviation and sea travel. It equals 1.852 kilometers or about 1.151 regular miles. It is based on one minute of latitude along Earth's surface, which makes it very useful for navigation.

Does this calculator show the work step by step?

Yes. After you click Calculate, the tool shows every step of the formula. For 2D and 3D, it shows each subtraction, squaring, addition, and square root. For geographic distance, it shows the coordinates, the method used, and results from both Lambert's and Haversine formulas along with the difference between them.


Related Calculators

Midpoint Calculator

Visit Midpoint Calculator