One Calculator Logo One Calculator
Mathematics & Statistics • Formulas shown

Distance Calculator (Between Two Points)

Quick Answer

The distance formula is d = √((x₂ − x₁)² + (y₂ − y₁)²), which is the Pythagorean theorem applied to coordinates. The distance from (1, 2) to (4, 6) is √(9 + 16) = 5. In 3D, add (z₂ − z₁)² under the root.

Result

The distance is 5

Midpoint(2.5, 4)
Squared distance25
Step-by-step calculation
  1. d = √((x₂ − x₁)² + (y₂ − y₁)²)
  2. = √(9 + 16 + 0) = 5

About the Distance Calculator

Enter two points and choose 2D or 3D. The calculator returns the straight-line (Euclidean) distance, the squared distance and the midpoint between the points.

This is the distance on a flat grid, not the distance between places on the Earth’s surface, which needs the haversine formula and latitude and longitude. For coordinate geometry, graphics and physics problems the Euclidean distance is what you need.

How to Use the Distance Calculator

  1. Choose 2D or 3D.
  2. Enter both points.
  3. Read the distance and midpoint.

Formula and Method

2D

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

3D

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

Midpoint

((x₁+x₂)/2, (y₁+y₂)/2)

Worked Example

A 3-4-5 triangle

Input: (1, 2) to (4, 6)

  • Δx = 3, Δy = 4
  • √(9 + 16)

Result: 5.

Frequently Asked Questions

Is it the same as the Pythagorean theorem?

Yes, with the coordinate differences as the legs.

Can I use latitude and longitude?

Not for accurate Earth distances; use a great-circle formula.

What is Manhattan distance?

|Δx| + |Δy|, the distance along grid lines.

What are the units?

The same as your coordinates.

Related Calculators

All Math & Statistics Calculators →

Sources and Further Reading

Accuracy and Scope

Results use standard IEEE-754 double-precision arithmetic and are rounded for display. For exam, engineering or research work, verify critical values with a second method. See our full disclaimer.