Calculator Hero

Distance Calculator

Calculates the Euclidean distance between two points in 2D or 3D, plus midpoint and slope.

Last updated: June 11, 2026

Distance Calculator

Point 1 (x₁, y₁)

Point 2 (x₂, y₂)

Enter both points to calculate the distance, midpoint, and slope

How to Use the Distance Calculator

This distance calculator finds the straight-line Euclidean distance between any two points in 2D or 3D space — select a mode, enter your coordinates, and it instantly returns the distance, the differences Δx and Δy (and Δz in 3D), the midpoint, and — in 2D mode — the slope. All inputs accept any real number, including negatives and decimals. For finding the center of a segment, see our midpoint calculator.

Use the Share button to copy a shareable link with your inputs pre-filled — useful for homework verification, collaboration, or saving calculations.

The Distance Formula

The distance formula computes the straight-line Euclidean distance between two points:

2D: d = √((x₂ − x₁)² + (y₂ − y₁)²)

3D: d = √((x₂ − x₁)² + (y₂ − y₁)² + (z₂ − z₁)²)

This is the Pythagorean theorem in coordinate form. For points (3, 0) and (0, 4): d = √((0−3)² + (4−0)²) = √(9 + 16) = √25 = 5. This is the classic 3-4-5 right triangle.

AdvertisementResponsive Ad

Distance Formula vs. Pythagorean Theorem

The distance formula and the Pythagorean theorem are the same relationship expressed in different contexts. In both cases, two legs form a right angle and the hypotenuse (or distance) satisfies:

d² = (Δx)² + (Δy)²

The Pythagorean theorem is typically used when you are working with a right triangle directly (given side lengths). The distance formula is used when you have coordinate points and want to find the length of the segment between them. They are two ways of expressing the same geometric truth. Our Pythagorean theorem calculator lets you solve for any missing side given the other two.

Manhattan Distance vs. Euclidean Distance

Not all distance problems call for Euclidean (straight-line) distance. Here are the most common distance metrics and when each applies:

  • Euclidean distance — straight-line distance, as the crow flies. Used in geometry, physics, GPS, and most real-world distance problems.
  • Manhattan distance (taxicab distance) — |Δx| + |Δy|. The distance traveled along a grid, like city blocks. Used when movement is constrained to horizontal/vertical paths.
  • Chebyshev distance — max(|Δx|, |Δy|). How many king moves in chess to travel from one square to another. Used in board games and some robotics problems.
  • Great-circle distance — distance along the surface of a sphere, using latitude/longitude. Used for real-world navigation and geographic distance between locations.

Real-World Applications of the Distance Formula

The distance formula is used across many fields:

  • Computer graphics — calculating distances between objects for collision detection, rendering, and path finding
  • GPS and navigation — computing straight-line distances between two geographic coordinates (simplified as Euclidean for short distances)
  • Machine learning — k-nearest neighbors (kNN) classification uses Euclidean distance to find the closest training examples
  • Physics — displacement between two positions in space
  • Engineering — verifying distances in CAD drawings and structural models
AdvertisementResponsive Ad

Step-by-Step Example: 3D Distance

Problem: Find the distance between P₁ = (1, 2, 3) and P₂ = (4, 6, 15).

  1. Δx = 4 − 1 = 3
  2. Δy = 6 − 2 = 4
  3. Δz = 15 − 3 = 12
  4. (Δx)² + (Δy)² + (Δz)² = 9 + 16 + 144 = 169
  5. d = √169 = 13

This is a 3D Pythagorean triple: 3² + 4² + 12² = 9 + 16 + 144 = 169 = 13². Midpoint: ((1+4)/2, (2+6)/2, (3+15)/2) = (2.50, 4.00, 9.00).

Sources & References

  1. Distance FormulaKhan Academy
  2. Euclidean DistanceMath Is Fun

Frequently Asked Questions

Related Calculators

Advertisement

320 × 50 — Mobile Anchor