Shapes & spaces

Trilateration calculator from anchor distances

Recover possible 2D or 3D positions from anchor distances, check every anchor and reveal mirror ambiguity or inconsistent inputs.

Your numbers

Use two through twenty rows. Distances must be nonnegative and all values within ±1,000,000.

Calculated on your device. Your inputs aren’t sent to us.

Your result

Ready when you are

Enter your inputs and select Calculate.

Report an issue

Behind the numbers

How this calculation works

Trilateration locates a point from distances to known anchor positions. Each distance describes a circle in a plane or a sphere in space. Their intersections can produce one position, two mirror-related positions or no consistent position. This page supports both dimensions on one calculator and checks all additional anchors instead of silently discarding them. It reports a numerical residual tolerance and does not substitute a least-squares fit when the supplied distances disagree.

THE FORMULA|X − Aᵢ| = rᵢ; subtract squared-distance equations, find both remaining signs, then verify every anchor.

A worked example

In 2D, anchors (0,0), (6,0) and (0,8), each at distance five, identify position (3,4). The first two circles alone intersect at (3,4) and (3,−4). The third anchor keeps only the upper position because its distance to (3,−4) is √153, not five. In 3D, three noncollinear anchors can leave two positions on opposite sides of their plane.

Good to know

Use two through twenty anchors in 2D, or three through twenty in 3D. Three-dimensional mode normally requires noncollinear anchor locations; a zero-distance anchor can fix the point directly. Degenerate configurations that leave a continuous family of positions are rejected. Coordinates and distances are finite and bounded by one million in magnitude, with distances nonnegative. Measurement uncertainty, Earth curvature and best-fit noisy localization are not modeled.

Distances can determine more than one valid location

Two circles usually have two intersections symmetric about the line connecting their centers. Calling either one the answer without another constraint would hide a real ambiguity. The default example shows how a third circle removes one candidate. With three spheres in space, the analogous candidates are reflected across the anchor plane. An additional anchor outside that plane can often distinguish them.

The solver constructs an anchor-relative orthonormal basis, subtracts squared distances to determine baseline or plane coordinates, and takes both signs of the remaining coordinate. It then checks each candidate against every entered row. A fourth anchor in the same plane does not necessarily remove a three-dimensional mirror ambiguity. Its location, rather than its mere presence, matters.

Two circle intersections are mirror candidates until the third anchor removes oneA1A2Both: (3,±4)Third keeps(3,4)
The first two default distance circles intersect at (3,4) and (3,−4). The third anchor (0,8), also at distance five, keeps only (3,4). Only the first two circles are drawn.

The Point-in-polygon calculator using winding number can apply an additional known planar region constraint after distance-derived candidates have been found.

No common intersection is different from a best-fit estimate

Real ranging measurements can disagree because of noise, bias or mixed units. This calculator returns zero admissible positions when no candidate meets all distances within the displayed numerical tolerance. It does not claim that the anchors or measurements are individually invalid, and it does not quietly average the disagreement into an apparently exact location. A least-squares localization model would answer a different question.

The tolerance scales with the supplied distance geometry and exists to accommodate floating-point arithmetic. It is not a confidence interval or a claim about sensor accuracy. Tangent surfaces may give one candidate; disjoint surfaces give none. Coincident or collinear anchors can leave infinitely many positions, which this finite-candidate interface rejects with an explanation. The coordinate distance calculator performs the forward task of checking distances between known positions, whereas this page solves the inverse task.

A few questions, answered

Why do three anchors in 3D sometimes give two answers?

Their centers define a plane. Reflection across that plane preserves distance to every anchor in it, so an off-plane pair can remain indistinguishable.

Can I mix meters and centimeters?

No. Coordinates and measured distances must use a single compatible length unit. Convert them before entering the rows.

Find your calculator

Start typing to explore the library.