Beginner

2D Distance Calculator — Distance Between Two Points

Enter the (x, y) coordinates of two points and instantly get the straight-line distance, midpoint, slope and angle of the connecting segment — plotted on an interactive grid.
Distance
5

Straight-line (Euclidean) distance between the two points

Midpoint
(1.5, 2)
Δx
3
Δy
4
Slope (rise / run)
1.3333
Angle from horizontal
53.13 °
Step by step
  1. 1

    Δx = x₂ − x₁

    3 − (0) = 3
  2. 2

    Δy = y₂ − y₁

    4 − (0) = 4
  3. 3

    Δx² + Δy²

    3² + 4² = 25
  4. 4

    Distance = √(Δx² + Δy²)

    √25 = 5
    Pythagorean theorem: the two separations form the legs of a right triangle.
P₁P₂
Results are estimates for general information only and are not professional advice — always verify important results independently before relying on them. Read the full disclaimer.
Quick answer

How does this calculator work?

Apply d = √((x₂−x₁)² + (y₂−y₁)²) — derived from the Pythagorean theorem — to find the straight-line length between two 2-D coordinates. Enter x₁, y₁, x₂, y₂ to also get the midpoint, slope and angle for free. Works for any unit system.

Formula
d = √((x₂ − x₁)² + (y₂ − y₁)²) • Midpoint = ((x₁+x₂)/2, (y₁+y₂)/2)
How this is calculated

The Euclidean (straight-line) distance formula is a direct application of the Pythagorean theorem. The horizontal separation Δx = x₂ − x₁ and the vertical separation Δy = y₂ − y₁ form the two legs of a right triangle, while the segment between the two points is the hypotenuse: d = √(Δx² + Δy²). No assumptions about units are made — the result is in whatever units your coordinates are in.

The midpoint sits exactly halfway along the segment, with coordinates ((x₁ + x₂) / 2, (y₁ + y₂) / 2). The slope is the rise divided by the run (Δy ÷ Δx); a vertical line (Δx = 0) has an undefined (infinite) slope. The angle is the arctangent of Δy / Δx measured counter-clockwise from the positive x-axis, reported in degrees (−180° to 180°).

The formula assumes a flat 2-D Euclidean plane — it does not apply to curved surfaces such as the Earth. For geographic distances you would need the Haversine formula. All results are floating-point approximations for irrational inputs.

Frequently asked questions

The Euclidean distance between (x₁, y₁) and (x₂, y₂) is d = √((x₂ − x₁)² + (y₂ − y₁)²). It follows from the Pythagorean theorem applied to the horizontal and vertical separations.

The midpoint M has coordinates ((x₁ + x₂) / 2, (y₁ + y₂) / 2) — the arithmetic averages of the two x-values and the two y-values.

If x₁ = x₂ and y₁ = y₂, then Δx = Δy = 0 and the distance is 0. The slope and angle are both 0 in that degenerate case.

Also known as

distance between two points
euclidean distance calculator
coordinate distance formula
xy distance calculator
point to point distance
distance formula calculator
midpoint and distance calculator

APA

TG we-Calculate Editorial Team. (2026). 2D Distance Calculator — Distance Between Two Points [Online calculator]. TG we-Calculate. https://we-calculate.com/calculator/2d-distance-calculator

Chicago

TG we-Calculate Editorial Team. "2D Distance Calculator — Distance Between Two Points." TG we-Calculate. 2026. https://we-calculate.com/calculator/2d-distance-calculator.

IEEE

TG we-Calculate Editorial Team, "2D Distance Calculator — Distance Between Two Points," TG we-Calculate, 2026. [Online]. Available: https://we-calculate.com/calculator/2d-distance-calculator

BibTeX

@misc{wecalculate_2d_distance_calculator, title = {2D Distance Calculator — Distance Between Two Points}, author = {{TG we-Calculate Editorial Team}}, howpublished = {\url{https://we-calculate.com/calculator/2d-distance-calculator}}, year = {2026}, note = {TG we-Calculate} }

Did this calculator help you?