Skip to main content

Distance Between Two Points Calculator

Find the Euclidean distance and midpoint between two points (x₁, y₁) and (x₂, y₂), with a step-by-step worked formula. Optional z-coordinates extend it to 3D.

Input

x-coordinate of the first point.

y-coordinate of the first point.

Optional z-coordinate of the first point — leave blank for a 2D distance.

x-coordinate of the second point.

y-coordinate of the second point.

Optional z-coordinate of the second point — leave blank for a 2D distance.

Output

Step-by-Step Solution
Was this helpful?

More ways to use this tool

REST API

curl -X POST https://api.iotools.cloud/v1/tool/distance-between-two-points-calculator \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "x1": "1",
    "y1": "2",
    "x2": "4",
    "y2": "6"
  }'

Swap in your own key from your account. The tool's fields are the body — no wrapper.

Ask an AI agent

Use the IOTools `distance-between-two-points-calculator` tool (Distance Between Two Points Calculator) on this input:

YOUR_INPUT_HERE

Paste this at any agent connected to the IOTools MCP server, then add your input.

Embed widget

<iframe
  src="https://iotools.cloud/embed/distance-between-two-points-calculator/"
  width="100%" height="520" frameborder="0" scrolling="no" loading="lazy"
  title="Distance Between Two Points Calculator — iotools.cloud"
  sandbox="allow-scripts allow-forms allow-same-origin allow-downloads allow-popups allow-popups-to-escape-sandbox"
  allow="clipboard-write"
  style="width:100%;border:1px solid #e5e7eb;border-radius:12px;overflow:hidden"></iframe>
<script src="https://iotools.cloud/embed.js" async></script>

Drop this into your own page — free, no key required, just a link back.

Cost per API/MCP callFrom 5 credits
Need more credits?View pricing

Also available with

Guides

The Distance Between Two Points Calculator finds the straight-line (Euclidean) distance between two points (x₁, y₁) and (x₂, y₂) on a coordinate plane, along with their midpoint and a step-by-step breakdown of the formula. Optional z₁/z₂ fields extend it to three dimensions.

It's built for students checking geometry homework, anyone plotting coordinates on a grid, and for a quick sanity check before feeding a distance into another calculation.

How to use it

  1. Enter the coordinates of Point 1 (x₁, y₁) and Point 2 (x₂, y₂).
  2. Read the Distance result.
  3. Check Midpoint for the point exactly halfway between the two.
  4. Open Step-by-Step Solution to see the formula plugged in with your actual numbers.
  5. For a 3D distance, also fill in z₁ and z₂ — leave them blank for the standard 2D case.

Results update automatically as you type. For example, (1, 2) and (4, 6) gives a distance of 5 and a midpoint of (2.5, 4).

The distance formula

The distance between two points is derived from the Pythagorean theorem:

d = √[(x₂ − x₁)² + (y₂ − y₁)²]

Add a (z₂ − z₁)² term under the root for the 3D case — the same idea extended one dimension further.

The midpoint

The midpoint is simply the average of each coordinate: ((x₁ + x₂)/2, (y₁ + y₂)/2), extended with (z₁ + z₂)/2 in 3D. For a fuller geographic midpoint tool — great-circle midpoint between latitude/longitude coordinates, with DMS output and distance from each point — see the Midpoint Calculator.

FAQ

Does this work in 3D?

Yes — fill in the optional z₁ and z₂ fields and the calculator switches to the 3D distance formula automatically. Leave them blank and it behaves exactly like the 2D case.

What if I need the slope or line equation instead of distance?

Use the Slope Calculator, which takes the same two points and returns the slope, the line's equation, and its angle of inclination (it also reports the distance between the points as a bonus).

What about distance between two GPS coordinates?

Latitude/longitude distance isn't a flat Cartesian calculation — Earth is a sphere. Use the Geo Distance Calculator for that instead.

Privacy

This calculator runs entirely in your browser. Your numbers are never uploaded, logged, or stored — the computation happens locally on your device.

euclidean distancetwo pointscoordinate geometrydistance formula3d distancemidpointpythagorean theoremalgebramath

Love the tools? Lose the ads.

One payment clears every ad from your account, for good. No subscription, no tracking.