Distance Formula Calculator

Choose your calculator☝️

Enter the coordinates (x1,y1)\hspace{0.2em} (x_1, y_1) \hspace{0.2em}

P1=(\hspace{0.2em} P_1 = ( \hspace{0.2em} , )\hspace{0.2em} ) \hspace{0.2em}

Enter the coordinates (x2,y2)\hspace{0.2em} (x_2, y_2) \hspace{0.2em}

P2=(\hspace{0.2em} P_2 = ( \hspace{0.2em} , )\hspace{0.2em} ) \hspace{0.2em}
distance between two points - illustration

Hello there!

Please provide your input and click the calculate button
Show Solution Hide Solution

About the Distance Formula Calculator

This distance formula calculator lets you calculate the distance between two points, from a point to a line, or between two parallel lines in a 2–D plane.

The calculator will tell you not only the distance, but also how to calculate it.

Usage Guide

Show Hide

i. Valid Inputs

Each input can be a real number in any format — integers, decimals, fractions, or even mixed numbers. Here are a few examples.

  • Whole numbers or decimals → 2\hspace{0.2em} 2 \hspace{0.2em}, 4.25\hspace{0.2em} -4.25 \hspace{0.2em}, 0\hspace{0.2em} 0 \hspace{0.2em}, 0.33\hspace{0.2em} 0.33 \hspace{0.2em}
  • Fractions → 2/3\hspace{0.2em} 2/3 \hspace{0.2em}, 1/5\hspace{0.2em} -1/5 \hspace{0.2em}
  • Mixed numbers → 51/4\hspace{0.2em} 5 \hspace{0.5em} 1/4 \hspace{0.2em}

IMPORTANT — When providing inputs for the linear equation, the coefficients of x\hspace{0.2em} x \hspace{0.2em} and y\hspace{0.2em} y \hspace{0.2em} cannot both be 0\hspace{0.2em} 0 \hspace{0.2em} at the same time. That would eliminate both variables from the equation and hence it will no longer be a linear equation.

ii. Example

If you would like to see an example of the calculator's working, just click the "example" button.

iii. Solutions

As mentioned earlier, the calculator won't just tell you the answer but also the steps you can follow to do the calculation yourself. The "show/hide solution" button would be available to you after the calculator has processed your input.

iv. Share

We would love to see you share our calculators with your family, friends, or anyone else who might find it useful.

By checking the "include calculation" checkbox, you can share your calculation as well.


Here's a quick overview of the distance formulas.

Distance in Analytical Geometry

In analytical geometry, we often need to find the distance between two points or two parallel lines or from a point to a line.

Let's look at the formulas we can use to find the distance for each of the three cases.

Distance Formula — Two Points

The distance d\hspace{0.2em} d \hspace{0.2em} between points P1(x1,y1)\hspace{0.2em} P_1\hspace{0.05em}(x_1, \hspace{0.2em} y_1) \hspace{0.2em} and P2(x2,y2)\hspace{0.2em} P_2\hspace{0.05em}(x_2, \hspace{0.2em} y_2) \hspace{0.2em} is given by —

d=(x2x1)2+(y2y1)2d \hspace{0.2em} = \hspace{0.2em} \sqrt{(x_2 - x_1)^2 + (y_2 - y_1)^2}

From a Point to a Line

The distance d\hspace{0.2em} d \hspace{0.2em} of a point P0(x0,y0)\hspace{0.2em} P_0\hspace{0.05em}(x_0, \hspace{0.2em} y_0) \hspace{0.2em} from a line ax+by+c=0\hspace{0.2em} ax + by + c = 0 \hspace{0.2em} is given by —

d=ax0+by0+ca2+b2d \hspace{0.2em} = \hspace{0.2em} \frac{|ax_0 + by_0 + c|}{\sqrt{a^2 + b^2}}

Two Parallel Lines

The distance d\hspace{0.2em} d \hspace{0.2em} between parallel lines ax+by+c1=0\hspace{0.2em} ax + by + c_1 = 0 \hspace{0.2em} and ax+by+c2=0\hspace{0.2em} ax + by + c_2 = 0 \hspace{0.2em} would be —

d=c1c2a2+b2d \hspace{0.2em} = \hspace{0.2em} \frac{|c_1 - c_2|}{\sqrt{a^2 + b^2}}

Note — For parallel lines, the x\hspace{0.2em} x–coefficients will be equal and the y\hspace{0.2em} y–coefficients will be equal too. If they are not equal, they can always be made equal multiplying/dividing any one of the equations by an appropriate factor.

That's why we have used the same coefficients, a\hspace{0.2em} a \hspace{0.2em} and b\hspace{0.2em} b \hspace{0.2em} for the two lines.

Distance Calculation

Share  via

Include calculation