MATH · COORDINATE DISTANCE
Coordinate Distance Calculator
Calculate the distance between two points in 2D or 3D, plus the midpoint and slope. Supports negative coordinates.
Distance5
Midpoint(1.5, 2)
Slope1.3333
About This Calculator
Find the straight-line (Euclidean) distance between two coordinate points in 2D or 3D space, along with the midpoint and — for 2D — the slope of the line connecting them. Negative coordinates are supported.
How It Works
Enter the x and y (and optionally z) coordinates for both points. The calculator computes: distance d = √((x₂−x₁)² + (y₂−y₁)²[+(z₂−z₁)²]); midpoint M = ((x₁+x₂)/2, (y₁+y₂)/2[, (z₁+z₂)/2]); and 2D slope m = (y₂−y₁)/(x₂−x₁). Vertical lines (x₁ = x₂) display "undefined" for slope.
The Formula
d = √((x₂−x₁)² + (y₂−y₁)²) M = ((x₁+x₂)/2, (y₁+y₂)/2) m = (y₂−y₁)/(x₂−x₁)
- x₁, y₁
- coordinates of point 1
- x₂, y₂
- coordinates of point 2
- d
- Euclidean distance
- M
- midpoint
- m
- slope of the connecting line
Frequently Asked Questions
- What is the distance formula?
- The distance formula derives from the Pythagorean theorem: for two points (x₁, y₁) and (x₂, y₂), the horizontal distance is |x₂−x₁|, the vertical distance is |y₂−y₁|, and the straight-line distance is √((x₂−x₁)² + (y₂−y₁)²).
- Can I use negative coordinates?
- Yes. The calculator accepts any real number (positive, negative, or zero) for all coordinate inputs. Negative coordinates are common in geometry and physics problems — for example, coordinates on opposite sides of an origin.
- What does it mean if the slope is undefined?
- When x₁ = x₂ (both points share the same x-coordinate) the line is vertical, and the slope is undefined (division by zero). The calculator shows "undefined (vertical line)" in that case.
- How is this different from the slope calculator?
- The slope calculator focuses on the slope and equation of the line, given two points or a point and a slope. This calculator focuses on the distance and midpoint, with slope as a bonus output.