Boneyard Tools

Distance Between Two Points Calculator

Enter the coordinates of two points to get the straight-line distance between them using the distance formula, along with the midpoint and the slope of the line joining them.

How to find the distance between two points

  1. Enter the coordinates of the first point as x1 and y1.
  2. Enter the coordinates of the second point as x2 and y2.
  3. Read the distance, midpoint and slope that update live.

Examples

A 3-4-5 right triangle

(0, 0) and (3, 4)
Distance 5, midpoint (1.5, 2), slope 1.333

A vertical line

(2, 1) and (2, 7)
Distance 6, slope undefined

Frequently asked questions

What is the distance formula?

For points (x1, y1) and (x2, y2), the distance is the square root of (x2 - x1) squared plus (y2 - y1) squared. It comes straight from the Pythagorean theorem, treating the horizontal and vertical gaps as the two legs of a right triangle.

How do I find the midpoint?

Average the coordinates: the midpoint is ((x1 + x2) / 2, (y1 + y2) / 2). It sits exactly halfway along the segment, so it is the same distance from each endpoint.

Why is the slope sometimes undefined?

The slope is the rise over the run, (y2 - y1) / (x2 - x1). When both points share the same x value the run is zero, which would mean dividing by zero, so the line is vertical and its slope is undefined rather than a number.

Can I measure distance in 3D?

Yes. The same idea extends to three dimensions by adding the squared difference in z under the square root. This tool focuses on 2D points but the underlying formula handles 3D coordinates the same way.

Does it work with negative or decimal coordinates?

Yes. Negative coordinates and decimals are fully supported, and the distance is always reported as a non-negative value because it squares the differences before taking the square root.

Related tools