Distance Between Two Points Calculator for 2D and 3D Coordinates

Stephanie Ben-Joseph headshot Stephanie Ben-Joseph

What the distance between two points means in 2D and 3D

This distance between two points calculator returns the length of the shortest straight segment joining two coordinates, whether they sit on a flat plane or in 3D space. Enter the coordinate pairs or triples and it evaluates the Euclidean separation from the values you provide.

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 switches between the plane and space automatically based on whether you include z-coordinates for both points.

Distance formula used by this calculator

The formulas here come straight from the Pythagorean theorem, so the calculator is measuring the hypotenuse of a right triangle built from the coordinate differences. That is why the result is always a straight-line distance rather than a route length or a path length.

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 of the distance between two points

If you plot the two coordinates on a grid, this calculator is really comparing the horizontal, vertical, and optional depth offsets between them.

  • The horizontal difference between the points is Δx = x2 − x1.
  • The vertical difference is Δy = y2 − y1.

Those two differences form the legs of a right triangle in the 2D case, and the straight-line distance is the hypotenuse. By the Pythagorean theorem:

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

Taking the square root of both sides gives the 2D distance formula that the calculator uses whenever the z fields are left blank. In 3D, there is one more offset, Δz = z2 − z1, and the same logic extends to three perpendicular directions:

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

Taking the square root again gives the 3D formula. This is the Euclidean metric in its most familiar form, and it is what makes the calculator report the direct separation between two points instead of a curved path or a traveled route.

How to use this distance-between-two-points calculator

  1. Enter the coordinates of the first point in the Point 1 fields, including z1 only if you want a 3D distance.
  2. Enter the coordinates of the second point in the Point 2 fields, matching the same 2D or 3D setup.
  3. Click the Calculate Distance button to see the straight-line distance.

2D vs 3D:

  • For a 2D distance, fill in x and y for both points and leave the z fields blank so the calculator stays in the plane.
  • For a 3D distance, fill in x, y, and z for both points so the result includes the depth difference as well.

The calculation runs entirely in your browser, so the coordinates stay on your device and are not sent to a server.

Worked examples for distance between two points

Example 1: 2D distance between two points

Suppose the distance-between-two-points calculator receives these coordinates in the plane:

  • Point 1: (x1, y1) = (1, 2)
  • Point 2: (x2, y2) = (5, 5)

Step 1: Compute the coordinate differences:

  • Δx = x2 − x1 = 5 − 1 = 4
  • Δy = y2 − y1 = 5 − 2 = 3

Step 2: Apply the 2D distance formula used by the calculator:

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

The straight-line distance between (1, 2) and (5, 5) is 5 units, so the output from this calculator would match the classic 3-4-5 triangle.

Example 2: 3D distance between two points

Now consider a pair of points in 3D space for the same calculator:

  • Point 1: (x1, y1, z1) = (2, −1, 3)
  • Point 2: (x2, y2, z2) = (6, 2, 7)

Step 1: Compute the coordinate differences:

  • Δx = 6 − 2 = 4
  • Δy = 2 − (−1) = 3
  • Δz = 7 − 3 = 4

Step 2: Apply the 3D distance formula used by the calculator:

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

Numerically, √41 ≈ 6.403. So the calculator would report a 3D straight-line distance of about 6.403 units for those coordinates.

Common uses for the distance between two points

Interpreting the result from this calculator is straightforward: it tells you how far apart the two coordinates are in a straight line, using the same units as your inputs. Larger values mean the points are farther apart, while smaller values mean they are closer together.

Typical uses include:

  • Geometry and algebra: solving problems that ask for the length of a segment between two coordinates.
  • Physics: computing displacement between positions in 2D or 3D.
  • Engineering and CAD: checking clearances and dimensions between features in a model.
  • Computer graphics and games: measuring distances between objects, for example when deciding whether two objects are close enough to interact.
  • Data analysis: using Euclidean distance as a simple measure of how similar or different two data points are.

Because the formula uses squared differences, negative coordinate values do not cause any special handling. Only the separation between the coordinates matters, and the final distance is always non-negative.

2D vs 3D distance comparison for this calculator

The table below compares the two coordinate setups that this distance-between-two-points calculator understands.

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 of the distance-between-two-points calculator

This distance-between-two-points calculator makes a few practical assumptions so the result stays simple and consistent:

  • Euclidean straight-line distance: It uses the standard Euclidean metric, so the answer is the length of the direct segment between the two points rather than the length of any path that bends or turns.
  • Cartesian coordinates: The formulas assume a Cartesian coordinate system where the x, y, and z axes are perpendicular and measured in consistent units.
  • Flat space approximation: For geographic locations on Earth, it does not account for the planet’s curvature. For long distances on the globe, you would need great-circle or geodesic formulas instead.
  • No obstacles or networks: Real-world travel distance along roads, corridors, or other constrained paths is usually longer than the straight-line distance returned here.
  • Numeric precision: The computation uses standard floating-point arithmetic in your browser. Extremely large or small values, or many decimal places, can introduce small rounding errors.

If you keep those assumptions in mind, the distance formula is a reliable and widely used way to measure how far apart two points are in both 2D and 3D settings.

Enter coordinates to compute the straight-line distance.

Beacon Gap Chase

This mini-game turns the distance-between-two-points idea into a moving target. Steer a drifting probe so its gap from the beacon stays inside the target band, and watch the straight-line distance respond as you move.

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

Use touch, drag, or the arrow keys to move the probe. Press space to steady the drift for a moment, and press Esc to pause or resume. Staying near the ring keeps your score climbing.

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.