# Distance formula calculator

> The distance formula gives the straight-line (Euclidean) distance between any two points (x₁, y₁) and (x₂, y₂) in a coordinate plane.

Calculate the distance between two points in a coordinate plane. Also returns the midpoint and slope of the connecting line.

**Interactive version:** https://onlinecalculator.me/math/distance-formula/
**Category:** Math

## Formula

```
d = √((x₂ - x₁)² + (y₂ - y₁)²)
```

This is the Pythagorean theorem applied to the horizontal and vertical legs of the right triangle formed by the two points.

## Example

Points A = (0, 0) and B = (3, 4):

```
d = √(3² + 4²) = √(9 + 16) = √25 = 5
```

Midpoint = (1.5, 2).

## Frequently asked questions

### What is the distance formula?

Distance = √((x₂-x₁)² + (y₂-y₁)²). It is derived from the Pythagorean theorem: the horizontal distance dx and vertical distance dy form the two legs of a right triangle, and the straight-line distance is the hypotenuse.

### What is the midpoint formula?

Midpoint = ((x₁+x₂)/2, (y₁+y₂)/2). The midpoint is exactly halfway between the two points.

### What if both points are the same?

Distance = 0 and the midpoint equals that single point.

### Does this work with negative coordinates?

Yes. Squaring the differences removes sign, so negative coordinates work correctly.

### How do I share my calculation?

Click "Share with my numbers" to copy a URL that saves all four coordinates.

## Sources

- [Euclidean distance (Pythagorean distance formula)](https://en.wikipedia.org/wiki/Euclidean_distance) — Wikipedia
- [Distance between two points (2D/3D/n-D)](https://mathworld.wolfram.com/Distance.html) — Wolfram MathWorld

## Related calculators

- [Slope calculator](https://onlinecalculator.me/math/slope/) — Slope, equation, and distance between two points.
- [Right triangle calculator](https://onlinecalculator.me/math/right-triangle/) — Solve right triangles from any two known values.
- [Quadratic formula calculator](https://onlinecalculator.me/math/quadratic/) — Roots of ax squared plus bx plus c.
- [Standard deviation calculator](https://onlinecalculator.me/math/standard-deviation/) — Sample and population standard deviation.

---

Part of [onlinecalculator.me](https://onlinecalculator.me/) — free calculators that run entirely in your browser.
Machine-readable index: https://onlinecalculator.me/llms.txt
