Find the midpoint of two points exactly, in two or three dimensions.
Distance Between Points Calculator
Find the straight-line distance between two points in two or three dimensions, exactly when the result is a whole number.
- Free
- No sign-up
- Runs in your browser
Input
A whole number, a decimal, or a fraction such as 3/4. Arithmetic is exact, so fractions stay exact.
A whole number, a decimal, or a fraction such as 3/4. Arithmetic is exact, so fractions stay exact.
Leave blank for a 2D calculation.
A whole number, a decimal, or a fraction such as 3/4. Arithmetic is exact, so fractions stay exact.
A whole number, a decimal, or a fraction such as 3/4. Arithmetic is exact, so fractions stay exact.
Leave blank for a 2D calculation.
How many digits to show when the answer is irrational. An exact answer ignores this.
Try an example
Ready
Everything happens on this device. No upload, no account, no network request.
How to use this tool
- 1
Enter the coordinates of both points. Fill in z only for a three-dimensional calculation.
- 2
The squared distance is always exact, so the distance is reported exactly whenever it is a whole number or a simple fraction.
Questions about Distance Between Points Calculator
Why is the distance from (0,0) to (3,4) reported as exactly 5?
Because the squared distance is 25, which is a perfect square. The tool checks that with integer arithmetic before approximating anything, so a Pythagorean triple gives an exact answer rather than 5.000000000000001.
What is the Manhattan distance for?
It is the sum of the coordinate differences - the distance you would walk on a street grid, where you cannot cut across. It is never less than the straight line, and it is the right measure for grid movement and for some clustering algorithms.
Why does this say the answer is exact?
Because it is. The arithmetic runs on exact fractions over arbitrary-precision integers, not floating-point numbers, so 1/3 + 1/3 + 1/3 is exactly 1 rather than 0.9999999999999999, and there is no rounding anywhere in the calculation. Where a result genuinely cannot be written exactly - a square root, a logarithm, anything involving pi - the page says so and gives a stated number of correct digits instead.
Is my data sent anywhere?
No. This runs as JavaScript in your browser tab: there is no network request carrying your numbers, nothing reaches a server log, and it keeps working with your connection off. You can confirm it in the browser’s network panel.
Does the Distance Between Points Calculator work offline?
Yes. Once the page has loaded it runs entirely as JavaScript on your own device, so the Distance Between Points Calculator keeps working with the network switched off and nothing is ever sent to a server.
Related tools
Other tools you might reach for next.
Find the slope of the line through two points, with its equation and angle, reporting a vertical line as vertical rather than as infinity.
Solve a right triangle for the hypotenuse or a missing leg, reported exactly for a Pythagorean triple.
Evaluate an expression with exact fraction arithmetic, trigonometry, logarithms and factorials, reporting whether the result is exact.
Reduce a fraction to lowest terms, with its mixed number and exact decimal form including any repeating block.
Add two fractions exactly, showing the common denominator step and reducing the result.
Subtract one fraction from another exactly, showing the common denominator step.
Multiply two fractions exactly, multiplying across and reducing the result.