Distance Between Two Points Calculator

Stephanie Ben-Joseph headshot Stephanie Ben-Joseph

What is the distance between two points?

The distance between two points is the length of the straight line that connects them. In a coordinate system, each point is written as a set of numbers (coordinates). This calculator lets you enter the coordinates of two points in 2D (x, y) or 3D (x, y, z) and returns the Euclidean straight-line distance between them.

In 2D, a point has coordinates (x1, y1) or (x2, y2). In 3D, a point has coordinates (x1, y1, z1) or (x2, y2, z2). The calculator automatically switches between 2D and 3D distance based on whether you provide z-coordinates.

Distance formula

The formulas used by this calculator come directly from the Pythagorean theorem, which relates the sides of a right triangle. The straight-line distance between two points is the length of the hypotenuse of a right triangle built from the coordinate differences.

2D distance formula

For two points in the plane, (x1, y1) and (x2, y2), the Euclidean distance d between them is:

d = √[(x2 − x1)² + (y2 − y1)²]

d = ( x2 x1 ) 2 + ( y2 y1 ) 2

3D distance formula

For two points in space, (x1, y1, z1) and (x2, y2, z2), the Euclidean distance d between them is:

d = √[(x2 − x1)² + (y2 − y1)² + (z2 − z1)²]

d = ( x2 x1 ) 2 + ( y2 y1 ) 2 + ( z2 z1 ) 2

Geometric interpretation

To see where these formulas come from, imagine plotting the two points on a coordinate grid.

These two differences form the legs of a right triangle. The distance between the points is the hypotenuse. By the Pythagorean theorem:

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

Taking the square root of both sides gives the 2D distance formula. In 3D, there is an extra dimension with difference Δz = z2 − z1. The length now satisfies:

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

Again taking the square root gives the 3D formula. This is an example of the Euclidean metric, which measures straight-line separation in standard Cartesian space.

How to use the calculator

  1. Enter the coordinates of the first point in the Point 1 fields.
  2. Enter the coordinates of the second point in the Point 2 fields.
  3. Click the Calculate Distance button to see the result.

2D vs 3D:

The calculation runs entirely in your browser. The coordinates you type are not sent to a server.

Worked examples

Example 1: 2D distance

Suppose you have two points in the plane:

Step 1: Compute the differences:

Step 2: Apply the 2D distance formula:

d = √[(Δx)² + (Δy)²] = √[(4)² + (3)²] = √(16 + 9) = √25 = 5

The straight-line distance between (1, 2) and (5, 5) is 5 units.

Example 2: 3D distance

Now consider two points in 3D space:

Step 1: Compute the coordinate differences:

Step 2: Apply the 3D distance formula:

d = √[(Δx)² + (Δy)² + (Δz)²] = √[(4)² + (3)² + (4)²] = √(16 + 9 + 16) = √41

Numerically, √41 ≈ 6.403. So the straight-line distance between the two 3D points is about 6.403 units.

Common uses and interpretation

Interpreting the result is straightforward: the distance tells you how far apart the two points are in a straight line, using the same units as your coordinates (meters, kilometers, inches, etc.). A larger value means the points are farther apart.

Typical uses include:

Because the formula is based on squared differences, negative coordinate values do not cause problems. Only the relative differences between the coordinates matter, and the final distance is always non‑negative.

2D vs 3D distance: comparison

The table below compares the key features of the 2D and 3D formulas used by this calculator.

Aspect 2D distance 3D distance
Point format (x1, y1) and (x2, y2) (x1, y1, z1) and (x2, y2, z2)
Formula d = √[(x2 − x1)² + (y2 − y1)²] d = √[(x2 − x1)² + (y2 − y1)² + (z2 − z1)²]
Dimensions measured Horizontal and vertical separation in a flat plane Separation in three perpendicular directions (often width, height, depth)
Typical use cases Graphs, maps of small areas, 2D diagrams, basic geometry problems 3D models, physics in space, engineering drawings, 3D games
Calculator inputs Only x and y fields filled; z fields left empty All x, y, and z fields filled for both points

Assumptions and limitations

This calculator makes several important assumptions:

If you keep these assumptions in mind, the distance formula is a reliable and widely applicable tool for measuring how far apart two points are in both 2D and 3D settings.

Enter coordinates to compute the distance.

Beacon Gap Chase

Steer a drifting probe so its distance from the beacon matches the target band. Feel the straight‑line distance come alive as every move stretches or shrinks the gap.

Target Gap --
Current Gap --
Streak 0.0s
Score 0
Time Left 90s

Tap or drag to steer the probe. Keyboard: ← → ↑ ↓ to nudge, space to steady drift, Esc to pause. Stay in the ring to multiply your score.

Play for 90 seconds by keeping the probe at the target distance from the beacon. Move with touch or arrow keys, press space to stabilize drift, and press Escape to pause or resume.

Embed this calculator

Copy and paste the HTML below to add the Distance Between Two Points Calculator to your website.