Back to home

Distance Calculator

Calculate the distance between two points in 2D or 3D space.

Point Coordinates
Enter coordinates for both points

Point 1

Point 2

About Distance Calculation

The distance formula is a direct application of the Pythagorean theorem. In 2D, the horizontal and vertical separations between two points form the legs of a right triangle, and the distance is the hypotenuse: d = √((x₂−x₁)² + (y₂−y₁)²). The 3D version extends naturally by adding the z-component: d = √((x₂−x₁)² + (y₂−y₁)² + (z₂−z₁)²).

The midpoint formula finds the center point between two points. In 2D it is ((x₁+x₂)/2, (y₁+y₂)/2), and in 3D it adds ((z₁+z₂)/2). The slope of a line through two points, m = (y₂−y₁)/(x₂−x₁), describes how steep the line is. A slope of 0 means horizontal; undefined slope (division by zero) means vertical.

Distance calculations are fundamental in coordinate geometry, physics (displacement), GPS systems, computer graphics (rendering and collision detection), and data science (nearest-neighbor algorithms like k-NN). The Euclidean distance formula used here is the most common metric, though other distance metrics like Manhattan distance are used in specialized contexts.

Take this calculation further

Browse the math calculators collection for more tools in this subject.

For a related calculation, use Slope Calculator to calculate slope, y-intercept, line equation, and angle of inclination from two points. Alternatively, use Triangle Calculator to solve any triangle from SSS, SAS, ASA, AAS, or SSA inputs using the Law of Sines and Law of Cosines.

For the underlying method, read How to Solve Any Triangle: Law of Sines vs. Law of Cosines.