Skip to main content
Distance calculator

The straight-line distance between two points.

Enter two points and see the distance, the midpoint, the slope and the angle of the line, plotted live on a coordinate grid. Flip on 3D to add a z-coordinate.

The two points

Point 1 (x₁, y₁)
Point 2 (x₂, y₂)
Distance between the points
0
units on the coordinate plane

What the numbers mean

    The key results

    How the distance is built

    The distance formula is the Pythagorean theorem applied to the differences between the coordinates. Each difference is squared, the squares are added, and the square root of the total is the distance.

    ComponentPoint 2Point 1 DifferenceSquared

    Distance and coordinate geometry, explained

    The Distance Formula

    The distance formula d = √((x₂-x₁)² + (y₂-y₁)²) calculates the straight-line distance between two points in a 2D plane. It is derived directly from the Pythagorean theorem by treating the horizontal and vertical differences as legs of a right triangle.

    The Midpoint Formula

    The midpoint between two points is M = ((x₁+x₂)/2, (y₁+y₂)/2). It is simply the average of the x-coordinates and the average of the y-coordinates. The midpoint divides the line segment into two equal halves.

    Distance in Different Contexts

    Euclidean distance (straight line) is the most common, but other distance metrics exist. Manhattan distance (|x₂-x₁| + |y₂-y₁|) measures grid-based travel. Chebyshev distance uses max(|Δx|, |Δy|). Each is useful in different applications like navigation, game development, and data science.

    Applications of Distance Calculations

    Distance formulas are used in GPS navigation, computer graphics (collision detection), data science (clustering algorithms), physics (displacement), urban planning, and game development. The 3D extension adds a z-component: d = √(Δx² + Δy² + Δz²).

    Common questions

    What is Euclidean distance?

    Euclidean distance is the straight-line ("as the crow flies") distance between two points. It is calculated using the distance formula derived from the Pythagorean theorem. It is the most intuitive and commonly used distance metric.

    Can distance be negative?

    No. Distance is always non-negative (≥ 0). The squaring in the formula ensures negative differences become positive. A distance of zero means the two points are the same.

    How do I calculate distance in 3D?

    Extend the formula: d = √((x₂-x₁)² + (y₂-y₁)² + (z₂-z₁)²). It works the same way but adds the z-coordinate difference squared under the radical.

    What is Manhattan distance?

    Manhattan distance (also called taxicab or L1 distance) is |x₂-x₁| + |y₂-y₁|. It measures the distance traveling along grid lines (like city blocks in Manhattan) rather than in a straight line.

    This tool computes Euclidean (straight-line) distance in a coordinate plane. It is not a road, driving or map distance. For travel distance use a mapping service.