AllCalciHub logo AllCalciHub
Math

Distance Calculator

Calculate the distance between two points in 2D or 3D space, plus midpoint coordinates and slope (2D).

What is Distance Calculator?

The distance calculator finds the straight-line (Euclidean) distance between two points using the distance formula derived from the Pythagorean theorem. It supports both 2D (x, y) and 3D (x, y, z) coordinate systems, and also returns the midpoint and slope for 2D.

How to use

  1. 1 Select 2D or 3D mode.
  2. 2 Enter the coordinates for the first point.
  3. 3 Enter the coordinates for the second point.
  4. 4 Click Calculate to get the distance, midpoint, and slope (2D only).
  5. 5 All coordinate inputs accept negative and decimal values.

Formula

2D distance = √((x₂−x₁)²+(y₂−y₁)²). 3D distance = √((x₂−x₁)²+(y₂−y₁)²+(z₂−z₁)²). Midpoint 2D = ((x₁+x₂)/2, (y₁+y₂)/2). Slope m = (y₂−y₁)/(x₂−x₁).

Example calculation

2D points (1,2) and (4,6): distance = √((4−1)²+(6−2)²) = √(9+16) = √25 = 5. Midpoint = (2.5, 4). Slope = 4/3 ≈ 1.333.

Frequently asked questions

What is Euclidean distance?

Euclidean distance is the straight-line distance between two points in space, named after Greek mathematician Euclid. It is the most common distance metric and generalizes to any number of dimensions.

How is 3D distance different from 2D?

3D distance adds a third dimension (z-axis) under the square root. The formula is √((x₂−x₁)²+(y₂−y₁)²+(z₂−z₁)²), a direct extension of the Pythagorean theorem.

Can distance be negative?

No. Distance is always a non-negative value. It represents the magnitude of the displacement between two points.

What is the difference between distance and displacement?

Distance is a scalar (magnitude only). Displacement is a vector (magnitude and direction). This calculator computes scalar distance.

What units does this calculator use?

The calculator is unit-agnostic. The result is in whatever units your coordinates represent — meters, kilometers, pixels, etc.