2D Distance Calculator

Enter two coordinate points, (x₁, y₁) and (x₂, y₂), to find the straight-line distance between them along with the midpoint, slope, and direction angle of the line that connects them.

Quick Facts

Distance formula
d = √((x₂−x₁)² + (y₂−y₁)²)
A direct application of the Pythagorean theorem, using Δx and Δy as the two legs of a right triangle.
Slope
(y₂−y₁) / (x₂−x₁)
Undefined when x₁ = x₂ (a vertical line), since that makes the denominator zero.

Your Results

Calculated
Distance
-
Straight-line distance between P1 and P2
Midpoint
-
Point exactly halfway between P1 and P2
Slope
-
Rise over run (Δy / Δx) of the connecting line
Angle
-
Direction from P1 to P2, from the positive x-axis

Ready

Enter both points, then press Calculate.

About 2D Distance

Coordinate geometry bridges algebra and geometry by assigning numerical addresses (coordinates) to points in space. This makes geometric relationships calculable using algebraic tools — including the straight-line distance between any two points, which this calculator finds using the four coordinates you enter: (x₁, y₁) for Point 1 and (x₂, y₂) for Point 2.

Core formulas

  • Distance between two points: √((x₂−x₁)² + (y₂−y₁)²) in 2D; add (z₂−z₁)² under the radical for 3D
  • Midpoint: ((x₁+x₂)/2, (y₁+y₂)/2)
  • Slope: (y₂−y₁)/(x₂−x₁) — undefined for vertical lines
  • Line equation: y = mx + b (slope-intercept), or Ax + By + C = 0 (standard form)

Worked example with the default points

With Point 1 at (0, 0) and Point 2 at (3, 4): Δx = 3, Δy = 4, so distance = √(3² + 4²) = √25 = 5 — the well-known 3-4-5 right triangle. The midpoint is (1.5, 2), the slope is 4/3 ≈ 1.333, and the angle from the positive x-axis is about 53.13°.

Coordinate systems

Cartesian (x, y, z) coordinates are most intuitive. Polar coordinates (r, θ) are more natural for rotational problems. Cylindrical and spherical coordinates extend polar to 3D. The conversion formulas between them are used constantly in physics and engineering.

Frequently Asked Questions

What is the distance formula in 2D?
The distance between two points (x₁, y₁) and (x₂, y₂) on a flat plane is d = √((x₂−x₁)² + (y₂−y₁)²). It comes directly from the Pythagorean theorem, treating the horizontal difference (x₂−x₁) and vertical difference (y₂−y₁) as the two legs of a right triangle and the distance as the hypotenuse.
How do you find the midpoint between two points?
The midpoint is the average of the x-coordinates and the average of the y-coordinates: M = ((x₁+x₂)/2, (y₁+y₂)/2). It is the exact center of the straight line segment connecting the two points.
What does it mean if the slope is undefined?
Slope is calculated as (y₂−y₁)/(x₂−x₁). When x₁ equals x₂, the two points sit on a vertical line and the denominator is zero, so the slope is mathematically undefined. This calculator reports "Undefined (vertical line)" in that case instead of an error.
Can this calculator be used for 3D distance?
No — this tool computes distance on a flat 2D plane using only x and y coordinates. For three dimensions, add a z term under the radical: d = √((x₂−x₁)² + (y₂−y₁)² + (z₂−z₁)²).