Distance Formula Calculator: Straight Line Distance Between Points

Written by:
PK

Below is a distance formula calculator, which computes the straight line (Euclidean) distance between two points. It works for 1 through 6 dimensions.

Distance Calculator

What is Euclidean distance?

The Euclidean distance or straight line distance is the length of the path between two points.

The formula is derived from the hypotenuse of a right triangle. If you drew two line segments from the points that met at a 90 degree angle, the opposite side (our distance) is called the hypotenuse.

Formula for Euclidean distance

The distance formula in two dimensions is:

d=\sqrt{(x_2-x_1)^2+(y_2-y_1)^2}

Where:

  • d: the distance between the two points (the hypotenuse)
  • x1, y1: the x and y coordinates of point 1
  • x2, y2: the x and y coordinates of point 2

Expand to three dimensions by adding the z-axis:

d=\sqrt{(x_2-x_1)^2+(y_2-y_1)^2+(z_2-z_1)^2}

For 1 dimension, distance simplifies to a simple difference:

d=|x_2-x_1|

Example distance calculation

Say you have 2 points (x, y): (3, 8) and (-1, 5).

d=\sqrt{(-1-3)^2+(5-8)^2}=\sqrt{16+9}=\sqrt{25}=5

Those two points are 5 units apart.

Using the distance formula calculator

First, select how many dimensions to use in the Dimensions dropdown. For standard X/Y coordinates, leave it at 2.

Enter coordinates for both points in the Point 1 and Point 2 fields. The distance will calculate automatically.

Related calculators

      

PK

PK started DQYDJ in 2009 to research and discuss finance and investing and help answer financial questions. He's expanded DQYDJ to build visualizations, calculators, and interactive tools.

PK lives in New Hampshire with his wife, kids, and dog.

Don't Quit Your Day Job...

DQYDJ may be compensated by our partners if you make purchases through links. See our disclosures page. As an Amazon Associate we earn from qualifying purchases.
Sign Up For Emails
linkedin facebook pinterest youtube rss twitter instagram facebook-blank rss-blank linkedin-blank pinterest youtube twitter instagram