Distance Calculator
Calculate the straight-line distance between two points in 2D or 3D space. Find the midpoint, coordinate differences, and a step-by-step solution using the distance formula.
Enter two points
Coordinates may be positive, negative, or decimal. Both points must use the same coordinate system and unit. This tool calculates straight-line coordinate distance, not driving or road distance.
Quick examples
Distance and midpoint
Coordinate diagram
Step-by-step solution
Distance formula
The distance formula calculates the straight-line distance between two coordinate points. It follows from the Pythagorean theorem: the coordinate differences form the legs of a right triangle, and the distance is its hypotenuse. Learn more about distance formulas.
Example: points (0, 0) and (3, 4)
The horizontal difference is 3 and the vertical difference is 4. Squaring and adding gives 3² + 4² = 9 + 16 = 25. The square root of 25 is 5, so the points are 5 units apart.
Δy = 4 − 0 = 4
d = √(3² + 4²) = √25 = 5 units
How to use this distance calculator
- Choose 2D or 3D coordinates.
- Enter the coordinates for Point A and Point B. In 3D mode, enter the z-coordinate for each point too.
- Select a unit label and decimal precision.
- Click Calculate distance to see the distance, midpoint, coordinate differences, and calculation steps.
This calculator handles Cartesian coordinates only. It does not calculate GPS great-circle distance, driving routes, or map distances. Coordinate values must share a consistent scale and unit.
Frequently asked questions
What is the distance formula?
In 2D, the distance formula is d = √[(x₂ − x₁)² + (y₂ − y₁)²]. In 3D, add the squared difference between the z-coordinates inside the square root.
Can I enter negative coordinates?
Yes. Negative, positive, and decimal coordinate values are supported. The result is based on the differences between corresponding coordinates.
What is the midpoint?
The midpoint is the point exactly halfway between two points. In 2D, average the x-coordinates and average the y-coordinates.
Does this calculate driving distance?
No. It calculates straight-line distance between Cartesian coordinates. Driving distance depends on roads and routes and requires a routing or map tool.
What is the difference between 2D and 3D distance?
2D distance uses horizontal and vertical coordinates (x and y). 3D distance also includes depth or height (z).
What if both points are the same?
If both points have identical coordinates, the distance is zero and the midpoint is that same point. The slope is undefined when the horizontal difference is zero.