Maths & numbers

Closest pair in a point cloud

Find the nearest two points and show their distance on a plot.

Closest pair in a point cloud
Esc to restore

Your inputs

Use exact X,Y headings, without repeating the first point unless closing a polygon.

Up to 25 MB per file, 50,000 data rows, 200 columns and 2 million data cells. Fully blank rows and columns are ignored before row, column and cell limits are checked. Individual tools may have smaller result or chart limits.

Results update as you type. Larger files run when you press Update result.

Your result

LOCAL & PRIVATE

Your result will appear here.

Your inputs stay in this browser. Nothing is uploaded or saved.

A clear answer. Here’s how.

Examines all unordered pairs of 2–1,000 two-dimensional points using Euclidean distance. Exact duplicate positions give zero distance. Ties retain the first encountered pair in original input order; the output uses source CSV row numbers. Coordinates share one unit, so the resulting distance has that unit. Uses O(n²) comparisons with a stated input cap.

See a worked example

Worked example

A fixed demonstration, separate from the values you enter above.

Point CSV
X,Y
0,0
4,0
2,1
2.2,1.1

Example result

Example result
Source rowXY
421
52.21.1

Closest Euclidean distance 0.22360679774997919. Ties use the first pair in input order; duplicate coordinates have zero distance.