Distance Formula Calculator: Straight Line Distance Between Points

Written by:
PK

Below is a distance formula calculator, which will calculate the straight line or Euclidean distance between two points. It works for (easier to reason through) 1, 2, or 3 dimensions, plus 4, 5, and 6 dimensions as well.

Also see the dedicated dimension Euclidean distance calculators:

Distance Calculator

What is the 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 angle triangle – if you drew two line segments from the points that met at a 90 degree angle, the opposite side length (our distance) called the hypotenuse, is easier to find.

Formula for Euclidean Distance

The formula for distance (in two dimensions) is:

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

Where:

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

You can expand the formula to any arbitrary number of dimensions by increasing the axes for the points. For example, this is the distance formula for 3 dimensions:

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

And now points 1 and 2 are described by (x1, y1, z1) and (x2, y2, z2), respectively.

"1 Dimension" distance is just a straight line distance on a single axis. It simplifies to a simple difference.

Here's the 1D distance formula:

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

Example Distance Calculation

Let's say you have 2 points, (x, y):

  • (3,8)
  • (-1, 5)

Here's how you do the math:

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

Those two points are 5 units apart.

Using the Distance Formula Calculator

First, you need to decide how many dimensions to use. If you only care for the X/Y axis, you should leave the Dimensions setting to 2.

Next, enter the coordinates of the two points. The top table holds information for the first point, the lower for the second.

When happy with your input, click the Compute Distance button and we'll return the Euclidean distance between the two points.

Had fun? Visit our other calculators and tools.

      

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