Distance Between Points Calculator

Calculate the distance between two points on a 2D plane, with the midpoint.

By Konstantin Iakovlev · Updated September 2026 · Source: Khan Academy

Distance

5.0000

Midpoint

(2.50, 4.00)

Calculation

dx3.00
dy4.00
Distance5.0000

Use the Distance Between Points Calculator above to calculate your results. Enter your values and see instant results — all calculations run in your browser.

Disclaimer: This calculator is for informational purposes only. Results are estimates based on the information you provide and the assumptions described on this page.

How It Works

Measuring the straight-line gap between two points is a routine need across navigation, engineering, and urban planning. This calculator works on a flat plane: enter two points (x1, y1) and (x2, y2), and it returns the distance between them, the midpoint, and the horizontal and vertical differences (dx and dy).

The method is the Pythagorean theorem, carried into more than one dimension. For two points in 2D, (x1, y1) and (x2, y2), the distance is D = sqrt((x2 - x1)^2 + (y2 - y1)^2). The calculator has no z inputs; for points in 3D space the same idea extends to D = sqrt((x2 - x1)^2 + (y2 - y1)^2 + (z2 - z1)^2), so square the calculator's 2D distance, add (z2 - z1)^2 and take the square root. The midpoint is ((x1 + x2)/2, (y1 + y2)/2).

Keep every coordinate in the same unit; pairing meters with kilometers will throw the answer off entirely. The classic slips in doing this by hand are forgetting to square each difference before adding them, or skipping the final square root, both of which the calculator handles for you. What it can't catch is a mistyped coordinate, so give your inputs a second look before relying on the result.

Example: Distance Between Two Delivery Hubs

  1. 1 On a city grid measured in kilometers, one delivery hub sits at (15, 20) and another at (40, 5). Enter x1 = 15, y1 = 20, x2 = 40, y2 = 5.
  2. 2 dx = 40 - 15 = 25 and dy = 5 - 20 = -15, so D = sqrt(25^2 + (-15)^2) = sqrt(625 + 225) = sqrt(850).
  3. 3 The calculator shows a distance of 29.1548 km and a midpoint of (27.50, 12.50).
  4. 4 Height barely matters at this scale: if one hub sits 0.1 km higher than the other, the 3D distance is sqrt(850 + 0.1^2) = sqrt(850.01) = 29.1549 km, about 17 cm more.

Source: Khan Academy · Last updated: September 2026

Frequently Asked Questions

What is the formula for distance between two points?
In 2D, the distance formula is the square root of (x2-x1)^2 + (y2-y1)^2, which is derived from the Pythagorean theorem. In 3D, add (z2-z1)^2 under the square root.
How is Manhattan distance different from Euclidean distance?
Euclidean distance is the straight-line distance between two points (the hypotenuse). Manhattan distance is the sum of the absolute differences of coordinates, like walking along a grid of city blocks. Manhattan distance is always greater than or equal to Euclidean distance.
Can I use the distance formula for GPS coordinates?
Not directly. GPS coordinates are on a sphere, so you need the Haversine formula for accurate distances. The simple distance formula works only for small distances (a few miles) where the curvature of the Earth is negligible.