ForHosting KIT · Math

Distance between two points in 3D

Give two points in space and get the straight line between them: from (0, 0, 0) to (3, 4, 12) is exactly 13, with the differences along x, y and z listed so no axis gets forgotten. Free in your browser.

  • Free
  • Runs in your browser
  • No sign-up
  • Your data stays on your device
Use it from WebAPIEmailTelegramApp soon
If you enter
X1
0
Y1
0
Z1
0
X2
3
Y2
4
Z2
12
You get
Distance
13
Dx
3
Dy
4
Dz
12

Given two points in three-dimensional Cartesian space, the straight-line separation is the Euclidean distance: the square root of the sum of squared differences in x, in y, and in z.

How the Euclidean formula measures distance in 3D space

Label the first point as (x1, y1, z1) and the second as (x2, y2, z2). The classical Pythagorean identity in three dimensions states that the length of the segment joining them is the square root of (x2 minus x1) squared plus (y2 minus y1) squared plus (z2 minus z1) squared. Classic classroom checks include the right-box legs of three, four, and twelve units, which produce distance thirteen, and the space diagonal of a unit cube from (0, 0, 0) to (1, 1, 1), which produces the square root of three.

Because the formula uses only subtraction, multiplication, addition, and a single square root, it is deterministic, O(1), and free of trigonometric libraries or iterative solvers. If you only need planar length, use a dedicated 2D distance tool rather than forcing a zero z that obscures the search intent of a true 3D calculation.

Where 3D point distance shows up in real work

Secondary-school and college solid-geometry courses constantly ask students to find the distance between two points in space; a trusted calculator with a strict numeric check speeds homework grading and removes spreadsheet mistakes where someone forgets to square all three deltas or omits the z term entirely. Game, graphics, and CAD tutorials often store sprites, nodes, and control points as triples of world coordinates; the distance answer feeds collision radii, snap thresholds, and path-length estimates without building a full computational-geometry stack.

Robotics, motion planning, and sensor pipelines that already express poses in a local Cartesian frame need the straight-line separation of two landmarks before reporting or controlling motion—having a shared numeric oracle keeps field notes, simulators, and office scripts aligned on the same Euclidean path. If you later need Manhattan distance, planar 2D Euclidean length, or great-circle distance on a globe, treat those as separate search intents rather than overloading this two-point spatial landing.

Homework and exam checks

Compute the straight-line distance between two 3D points and reject non-numeric coordinates with a clear error.

Game, CAD, and robotics helpers

Turn two 3D coordinate triples into a Euclidean length for snap radii, collision proxies, and path segments.

What formula does this calculator use?

The 3D Euclidean formula: distance = √((x2 − x1)² + (y2 − y1)² + (z2 − z1)²).

What happens if a coordinate is not a number?

Missing fields, empty strings, non-numeric text, NaN, and Infinity are all rejected.

Does point order matter?

No. Distance is symmetric: swapping the two points yields the same non-negative length (dx, dy, and dz flip sign).

Is this different from the 2D distance calculator?

Yes. This tool requires six coordinates (x, y, z for each point) and measures space length. Planar-only problems should use a dedicated 2D Euclidean tool.

What does it cost?

The browser tool is free and runs locally.

Everything on this page is available programmatically. This section is for teams who want to wire it into their own systems; everyone else can just use the tool above.

POSThttps://api.kit.forhosting.com/geom/distance-3d

Prefer to automate it? One authenticated POST creates the task; the result comes back by webhook or a signed link. The same capability also runs here on the web, by email and from Telegram — and soon from our app too.

curl -X POST https://api.kit.forhosting.com/geom/distance-3d \
  -H "Authorization: Bearer $KIT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"x1":0,"y1":0,"z1":0,"x2":3,"y2":4,"z2":12}'
{
  "x1": 0,
  "y1": 0,
  "z1": 0,
  "x2": 3,
  "y2": 4,
  "z2": 12
}
{
  "task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
  "type": "geom.distance_3d",
  "status": "queued",
  "_links": {
    "result": "/tasks/tsk_…/result"
  }
}

The API is asynchronous: the call returns a task_id immediately and the result arrives by webhook. Polling is capped at 1 req/s per task.

Per request$0.002

Published price — no tokens, no invented credits. A failed task is never charged.

HTTPCodeMeaning
401unauthorizedMissing or invalid API key.
402insufficient_balanceYour balance doesn't cover the task price.
404unknown_typeThat task type doesn't exist.
429rate_limitedToo many requests. Use the webhook instead of polling.

This calculator accepts x1, y1, z1, x2, y2, and z2 as finite numbers, validates every coordinate, and returns the non-negative distance together with the normalized points, the deltas dx, dy, and dz, and a method tag of euclidean_3d. Missing fields, empty strings, non-numeric text, NaN, and Infinity are rejected with a clear invalid_input error instead of a silent NaN that looks like a successful solve. No network calls, no random sampling, and no floating-point surprises beyond ordinary IEEE-754 arithmetic on the six numbers you provide.

How the Euclidean formula measures distance in 3D space

That expression is always non-negative, is zero exactly when the two points coincide, and is symmetric under swapping the two endpoints. Large coordinates can still overflow IEEE-754 double range when squared; when the intermediate sum is non-finite the request fails with a clear overflow message instead of returning Infinity in JSON. That closed path matches how analytic geometry textbooks, solid-geometry primers, and computational geometry courses present the distance-between-two-points-in-space problem, and it keeps automated graders and pipelines aligned with hand computation without unit conversion or map projections mixed into the same call.

What you send and what you get back

Provide six required finite numbers: x1, y1, and z1 for the first point, and x2, y2, and z2 for the second. After parsing, the service computes dx equals x2 minus x1, dy equals y2 minus y1, and dz equals z2 minus z1, takes the square root of dx squared plus dy squared plus dz squared, and checks that the distance is a finite number. Example checks: zero, zero, zero, three, four, twelve yields distance thirteen; zero, zero, zero, one, one, one yields the square root of three rounded; a non-numeric z2 fails naming that field. Wire the free browser tool for quick sanity checks, then call the identical contract from scripts when you need bulk evaluation of spatial distances without reimplementing the numeric gate in every language. Short aliases ax, ay, az, bx, by, bz and x_a through z_b are accepted so form labels can stay compact without diverging handlers. Missing fields, empty strings, non-numeric text, NaN, and Infinity are rejected with invalid_input and are not charged. On success the JSON response returns distance rounded for stable serialization, echoes the six normalized coordinates, includes dx, dy, and dz, and sets method to the string euclidean_3d so logs and teaching UIs can document the metric. API pricing is the published base of $0.002 per successful item.

Where 3D point distance shows up in real work

Because this capability is a pure parse engine, failed validation does not consume balance and successful runs stay at $0.002 per item.

Local-frame survey and sensor segments

From two Cartesian endpoints in space, recover segment length before reporting or controlling motion.

Read the full KIT documentation →