Distance Between Two Points Calculator

Written by Thierno Sadou Diallo, formula verified per our methodology • Last checked on 9/5/2026

The distance between two points (x₁,y₁) and (x₂,y₂) is calculated as d = √((x₂−x₁)² + (y₂−y₁)²). For points A=(1,1) and B=(4,5), the distance is exactly 5, a special case of the 3-4-5 triangle.

Explanation

Calculating the distance between two points identified by their coordinates is a direct application of the Pythagorean theorem: the coordinate differences between the two points (the horizontal gap and the vertical gap) form the two legs of an imaginary right triangle, whose hypotenuse is the distance being sought. This is exactly the same principle as our Pythagorean hypotenuse calculator, but applied to a different use case: rather than starting from two already-known side lengths, this calculator starts from two points identified by their coordinates in a Cartesian coordinate system, a very common situation in mapping (straight-line distance between two locations on a map), computer graphics (distance between two pixels or two interface elements), and analytic geometry more generally. This formula generalizes directly to three-dimensional space by adding a third coordinate (z) under the square root, the same principle then applying to a right triangle in space rather than on a plane.

Example: points A=(1,1) and B=(4,5)

Inputs

Point A: (1, 1). Point B: (4, 5).

Calculation

d = √((4−1)² + (5−1)²) = √(3² + 4²) = √(9 + 16) = √25 = 5.

Result

The distance between points A and B is exactly 5, a special case of the 3-4-5 triangle.

Frequently asked questions

Why is this formula an application of the Pythagorean theorem?

Because the difference between the x-coordinates of the two points, and the difference between their y-coordinates, form respectively the two legs of an imaginary right triangle whose hypotenuse is the distance being sought — the straight line directly connecting the two points. Squaring these two differences, adding them, then taking the square root of the result is nothing other than the Pythagorean theorem applied to this triangle formed by the coordinates.

Does this formula also work in three dimensions?

Yes, by simply adding a third coordinate (z): d = √((x₂−x₁)² + (y₂−y₁)² + (z₂−z₁)²), the same Pythagorean theorem principle generalized to three-dimensional space. This calculator deliberately sticks to the plane (two dimensions), the most common case in everyday, mapping, or educational use.

Does this distance correspond to a real distance on a map or GPS?

This formula gives a 'straight-line' distance on a flat Cartesian plane, suited to coordinates already expressed in a flat coordinate system (like coordinates in meters on a local map). For geographic coordinates expressed as latitude and longitude on the curved surface of the Earth, a different calculation (accounting for the Earth's curvature) is needed for an accurate distance over large distances. To locate a point by its distance and angle rather than by Cartesian coordinates, see our rectangle area and perimeter calculator for other plane-geometry basics.

Related resources

Similar calculators