Euclidean Distance Calculator
Table of contents
What is the Euclidean distance?How do I calculate the Euclidean distance?Euclidean distance between two pointsEuclidean distance of three pointsEuclidean distance between a point and a lineEuclidean distance between two parallel linesA different point of view: Euclidean distance as a distance between points in a setHow do I use the Euclidean distance calculator?Euclidean distance and beyondFAQsIt may sound fancy, but the Euclidean distance is nothing more than the distance the way we think of it every day: discover more on how to calculate it with our Euclidean distance calculator!
Here you will learn:
 What is the Euclidean distance?
 Formulas:
 The distance between two points and the distance between three points;
 The distance between a point and a line;
 The distance between two lines.
 Other uses of the Euclidean distance.
What is the Euclidean distance?
The Euclidean distance is a metric defined over the Euclidean space (the physical space that surrounds us, plus or minus some dimensions). In a few words, the Euclidean distance measures the shortest path between two points in a smooth ndimensional space.
We can define the Euclidean distance only in flat spaces: on curved surfaces, strange things happen, and straight lines are not necessarily the shortest!
How do I calculate the Euclidean distance?
The Euclidean distance is defined through the Cartesian coordinates of the points under analysis. We can think of it as the translation vector between two points. In our Euclidean distance calculator, we teach you how to calculate:
 The Euclidean distance between two or three points in spaces form one to four dimensions;
 The Euclidean distance between a point and a line in a 2D space; and
 The Euclidean distance between two parallel lines in a 2D space.
Euclidean distance between two points
To find the Euclidean distance between two points. you need to know the coordinates of these points.
Take a generic point $p$. We can write its coordinates as:
The number of components depends on the dimensionality of the space.
To calculate the distance between the point $p$ and the point $q$, we apply a generalized form of the Pythagorean theorem:
Where $n$ is the dimensionality of the space.
As you can see, it's pretty easy!
Euclidean distance of three points
If we add a point, we will find three possible distances; three points, after all, always define a triangle (possibly degenerated).
Taking the triple of points $p$, $q$, and $r$, we can find the following two points distances:
This concept can obviously expand to increasingly larger ntuples.
Euclidean distance between a point and a line
To find the distance from a point to a line (in two dimensions), we need to consider the fact that a line is nothing but a collection of points satisfying an equation. The distance between a point and a line is then the minimum distance between the point and the line.
The segment connecting the point to the point on the line satisfying the condition above is perpendicular to the line itself. To find the distance, we use this formula:
Where $a$, $b$, and $c$ are the coefficient of the equation of the line in the form: $a\cdot x + b\cdot y + c = 0$. If we are considering the more commonly found expression $y = m\cdot x + c$, we would use this formula (equivalent in every way):
Euclidean distance between two parallel lines
To calculate the distance between two parallel lines we use the following equation:
The lines have equations:
 $a_1\cdot x+b_1\cdot y_1 + c_1$; and
 $a_2\cdot x+b_2\cdot y_1 + c_2$.
However, there is a strong constraint over the choices of coefficients. Since two nonparallel lines would cross at a certain point in the plane, giving a trivial distance $d=0$, we define the Euclidean distance only in the case of parallel lines. This gives us quite some helpful rules:
 $a_1=a_2=a$;
 $b_1=b_2=b$;
 However, $c_1\neq c_2$.
Using the slopeintercept form of the equation of a line, the formula for the distance becomes:
A different point of view: Euclidean distance as a distance between points in a set
The Euclidean distance is becoming an important concept in machine learning (the less scifi version of AI), where the distance between points in arbitrary spaces of features is measured with metrics. The most commonly used ones are:
 The Minkowski distance;
 The Manhattan distance; and
 The Euclidean distance.
Each of them is appropriate for certain data: the Manhattan distance for integer values and the Euclidean distance for realvalued data. The Minkowski distance is a generalization of both.
It is interesting to notice how a physical, and concrete, concept (the distance between two points) is translated into a distance in a space of features: the difference is from calculating the distance between your house and the one of a friend to a generalized distance between two colors, two car models...
How do I use the Euclidean distance calculator?
First, choose the objects you are calculating the distance: for points, you can also choose the dimensionality of the space.
Then, insert the coordinates of the points or the parameters of the lines. We will show both the distance and the steps to calculate it. There is nothing more to it!
Euclidean distance and beyond
The Euclidean distance is a particular — yet common — way to measure the distance. We made more calculator specific to certain topics and problems:
What is the distance between two parallel lines with equations y = 2x + 3 and y = 2x  4?
The distance is 3.13. To calculate it,

We identify the parameters of the lines:

m=2 (the value is the same for both lines since they are parallel); and

c₁ = 3, and c₂ = 4.


We apply the equation for the distance between two parallel lines:
d =  c₁  c₂ /(√[m² + 1])
d =  3 + 4 /(√[2² + 1] = 3.13
How do I calculate the distance between a point and a line?
To calculate the distance between a point and a line, follow these steps:

Define the coordinates and parameters of the objects.

Calculate the distance using the formula:
d =  m × p₁ + q₁ + c /(√[m² + 1])

And that's it! To compute the distance, we had to calculate the area of a triangle in coordinates space and then calculate its height.
Is the distance formula still valid in a 4dimensional space?
Yes: the concept of distance exists in any Euclidean space with an arbitrary number of dimensions. It may be hard to visualize a 4dimensional space, though. Imagine a car that moved from a point A
to a point B
in a certain time t
. If you take time as your fourth dimension, you can see that, if you freeze the movement, the car is not moving: we need the fourth dimension to define the distance!
What is the distance between the point p = (1,2) and the point q = (2,3)?
d = 1.414. To calculate the distance between these two points on a plane, we simply apply the formula:
√[(p₂  p₁)² + (q₂  q₁)²]
In this case:
√[(2  1²) + (3  2²] = √2 = 1.414
Notice how the distance between these two particular points corresponds both to the hypotenuse of a right triangle and the diagonal of a square.