Distance Between Points Calculator

Use this Distance Between Points Calculator to enter values, adjust options, and review results in a compact responsive workspace.

Results are calculated automatically as you enter data.

Point A
Point B

Distance

▼ See explanations and tips below ▼

What Is Euclidean Distance Between Points?

Euclidean distance is the straight-line distance between two points in a flat coordinate system. In everyday language, it answers the question: “How far apart are these two points if you could travel directly from one to the other?”

In a 2D coordinate plane, each point has an \(x\)-coordinate and a \(y\)-coordinate. In 3D space, each point also has a \(z\)-coordinate. The distance between the points is found by comparing the coordinates axis by axis, then using the Pythagorean theorem to combine those differences into one straight-line length.

For two points \(A\) and \(B\), the result is the length of the segment connecting them. It is always nonnegative. A distance of \(0\) means the two active-coordinate points are the same point.


Why Straight-Line Distance Matters

The distance formula connects geometry and algebra. Instead of measuring a line segment with a ruler, you can calculate its length from coordinates.

This is useful in coordinate geometry, algebra, analytic geometry, vectors, graphing, 3D modeling, physics, computer graphics, and many classroom problems. It also helps you distinguish between direct distance and path distance. A direct distance is the length of the straight segment between two points; a route or path distance may be longer because it follows roads, grid paths, obstacles, or curved surfaces.


Key Terms to Know

  • Coordinate point: A location written with coordinates, such as \((x, y)\) in 2D or \((x, y, z)\) in 3D.
  • Cartesian coordinates: A coordinate system that uses perpendicular axes, usually called \(x\), \(y\), and sometimes \(z\).
  • Coordinate difference: The change from one point to another along one axis, such as \(dx = x_B - x_A\).
  • Distance squared: The sum of squared coordinate differences before taking the square root.
  • Euclidean distance: The straight-line distance in flat 2D or 3D space.
  • Midpoint: The point exactly halfway between two endpoints, found by averaging corresponding coordinates.
  • Radical form: A square-root form such as \(\sqrt{61}\), often used as an exact or exact-style distance expression.
  • Decimal approximation: A numerical estimate of the distance, such as \(7.8102496759\).

How the Distance Formula Works

The distance formula is the Pythagorean theorem applied to coordinate differences.

In 2D, imagine two points connected by a diagonal segment. The horizontal difference is one leg of a right triangle, and the vertical difference is the other leg. The distance between the points is the hypotenuse.

Let the two points be:

$$ A(x_A, y_A) \quad \text{and} \quad B(x_B, y_B) $$

First find the coordinate differences:

$$ dx = x_B - x_A $$
$$ dy = y_B - y_A $$

Then square and add the differences:

$$ d^2 = dx^2 + dy^2 $$

Finally, take the square root:

$$ d = \sqrt{dx^2 + dy^2} $$

Written directly with coordinates, the 2D distance formula is:

$$ d = \sqrt{(x_B - x_A)^2 + (y_B - y_A)^2} $$

In 3D, the idea is the same, but there is one more coordinate difference:

$$ dz = z_B - z_A $$

The 3D distance formula is:

$$ d = \sqrt{(x_B - x_A)^2 + (y_B - y_A)^2 + (z_B - z_A)^2} $$

The midpoint is found by averaging matching coordinates. In 2D:

$$ M = \left(\frac{x_A + x_B}{2},\frac{y_A + y_B}{2}\right) $$

In 3D:

$$ M = \left(\frac{x_A + x_B}{2},\frac{y_A + y_B}{2},\frac{z_A + z_B}{2}\right) $$

Examples of Distance Between Points in Practice

Example 1: A 2D distance that simplifies neatly

Suppose:

$$ A(-2, 1) \quad \text{and} \quad B(4, 9) $$

Find the coordinate differences:

$$ dx = 4 - (-2) = 6 $$
$$ dy = 9 - 1 = 8 $$

Square and add them:

$$ d^2 = 6^2 + 8^2 = 36 + 64 = 100 $$

Take the square root:

$$ d = \sqrt{100} = 10 $$

The distance between the points is \(10\) coordinate units. The midpoint is:

$$ M = \left(\frac{-2 + 4}{2},\frac{1 + 9}{2}\right) = (1, 5) $$

Example 2: A 3D distance

Suppose:

$$ A(-1, 2, 4) \quad \text{and} \quad B(5, -2, 1) $$

Find the coordinate differences:

$$ dx = 5 - (-1) = 6 $$
$$ dy = -2 - 2 = -4 $$
$$ dz = 1 - 4 = -3 $$

Square and add:

$$ d^2 = 6^2 + (-4)^2 + (-3)^2 = 36 + 16 + 9 = 61 $$

Take the square root:

$$ d = \sqrt{61} \approx 7.8102496759 $$

The negative signs in \(dy\) and \(dz\) do not make the distance negative, because each coordinate difference is squared. The signs only show direction from Point A to Point B along each axis.

The midpoint is:

$$ M = \left(\frac{-1 + 5}{2},\frac{2 + (-2)}{2},\frac{4 + 1}{2}\right) = (2, 0, 2.5) $$

Example 3: Same point or one-axis movement

If both active-coordinate points are the same, such as:

$$ A(3, -2) \quad \text{and} \quad B(3, -2) $$

then:

$$ dx = 0, \quad dy = 0 $$
$$ d = \sqrt{0^2 + 0^2} = 0 $$

A zero distance means there is no separation between the two points.

If only one coordinate changes, the distance is simply the absolute size of that one change. For example:

$$ A(3, -2) \quad \text{and} \quad B(3, 4) $$

Here \(dx = 0\) and \(dy = 6\), so:

$$ d = \sqrt{0^2 + 6^2} = 6 $$

How to Interpret the Result

The main distance result is the straight-line length from Point A to Point B. It uses the same implied unit as the coordinate axes. If the coordinates represent meters, the distance is in meters. If the coordinates represent grid units, the distance is in grid units. If no physical unit is assigned, the result is unitless coordinate distance.

A smaller distance means the points are closer together. A larger distance means the points are farther apart in the coordinate system. A distance of \(0\) means the two active-coordinate points match exactly.

The exact radical or exact-style square-root form shows the distance before converting it fully into a decimal. For example, \(\sqrt{61}\) is more exact than a rounded decimal approximation. The decimal form is often easier to compare, estimate, or use in practical calculations.

Distance squared is the value inside the square root. It is not the final distance unless the square root happens to equal the same number, which is uncommon. For example, if \(d^2 = 61\), then \(d = \sqrt{61}\), not \(61\).

Coordinate differences show how Point B differs from Point A along each axis. Reversing Point A and Point B changes the signs of these differences, but the final distance stays the same.

The midpoint tells you the coordinate exactly halfway between the two points. It is useful when you need the center of a segment, the center of a diameter, or a halfway location in a coordinate model.


Common Mistakes and Misconceptions

A common mistake is confusing distance with distance squared. The squared value is an intermediate step. The final distance requires taking the square root.

Another mistake is expecting all coordinate differences to be positive. A coordinate difference can be negative because it includes direction, but distance itself is never negative.

In 3D problems, make sure the calculation is actually using 3D mode. If a point has \(z\)-coordinates but the calculation is in 2D, the \(z\)-values do not affect the result.

Do not mix units across axes. If \(x\) is measured in meters but \(y\) is measured in feet, the distance formula does not automatically fix the mismatch. Convert all coordinates to the same unit system before calculating.

Do not use this flat Cartesian formula for latitude and longitude on Earth unless the coordinates have first been converted into an appropriate flat coordinate model for the purpose. Distances on a sphere or curved surface require different methods.

The order of Point A and Point B does not change the distance. It only changes the signs of \(dx\), \(dy\), and \(dz\).


When to Use Euclidean Distance

Use Euclidean distance when you need the direct straight-line distance between two points in a flat coordinate system.

It is especially useful for:

  • Finding the length of a segment on a coordinate plane.
  • Solving analytic geometry problems.
  • Comparing how far apart points are in 2D or 3D space.
  • Working with vectors, where distance is closely related to magnitude.
  • Finding direct distances in diagrams, grid models, design layouts, or 3D coordinate models.
  • Checking whether two points are the same point.
  • Finding a midpoint along with the distance between endpoints.

Limitations and Things to Keep in Mind

The formula assumes a flat Cartesian coordinate system. It does not account for curved surfaces, geographic latitude and longitude, road networks, obstacles, map projections, or non-Euclidean geometry.

All coordinate axes should use the same implied unit. The result uses that same unit. There is no meaningful unit conversion unless the coordinates themselves have already been converted.

Only the active dimensions matter. In 2D, the calculation uses \(x\) and \(y\). In 3D, it uses \(x\), \(y\), and \(z\).

Very large or very small values may be displayed in scientific notation. Coordinates are limited to 15 significant digits, and inputs that cannot be represented distinctly are rejected. Decimal results may be rounded for display and should be treated as numerical approximations.

Exact radical simplification is used only when every active coordinate is a safe integer. Decimal inputs receive a numerical approximation. If a finite distance has a square above or below the floating-point range, the distance remains available while the Distance squared card reports that range limitation.

For schoolwork, follow your teacher’s instructions about exact form, decimal approximation, and rounding. For engineering, surveying, mapping, physics, or safety-related work, make sure the coordinate system, units, measurement accuracy, and model assumptions are appropriate for the task.


How to Use This Calculator

  1. Choose 2D mode for points with \(x\)- and \(y\)-coordinates, or 3D mode for points with \(x\)-, \(y\)-, and \(z\)-coordinates.
  2. Enter the coordinates for Point A.
  3. Enter the coordinates for Point B.
  4. Review the distance result, including the square-root form and decimal form.
  5. Check the details for coordinate differences, distance squared, midpoint, formula substitution, and the quick interpretation note.
  6. Use the example buttons if you want to load sample coordinates.
  7. In 3D mode, adjust yaw and pitch to rotate the graph preview. These controls change only the view, not the distance.
  8. Use the graph download option when a graph is visible and you want to save the current preview as an image.

Frequently Asked Questions

Is the distance between two points always positive?

The distance is always nonnegative. It is positive when the two points are different, and it is \(0\) when the active-coordinate points are exactly the same.


Why are the coordinate differences squared?

The differences are squared because the distance formula comes from the Pythagorean theorem. Squaring also removes sign, so a difference of \(-4\) contributes the same length as a difference of \(4\).


Does it matter which point is Point A and which is Point B?

The final distance does not change if you swap Point A and Point B. The coordinate differences change sign, but their squares stay the same.


What is the difference between distance and midpoint?

Distance is a length. It tells you how far apart the two points are. The midpoint is a coordinate point, not a length; it tells you where the halfway point of the segment is.


Why does the answer sometimes show a square root and a decimal?

The square-root form can preserve the exact or exact-style structure of the answer. The decimal form is an approximation that is easier to read and compare, especially when the square root is not a whole number.


Can this be used for latitude and longitude?

Not directly. Latitude and longitude describe positions on the Earth’s curved surface, while this formula assumes flat Cartesian coordinates. Geographic distance problems usually need a method designed for spherical or ellipsoidal Earth models, or coordinates converted into a suitable flat projection.


Sources and References

Books and Open Textbooks

  1. Jay Abramson. College Algebra 2e. OpenStax, 2021. Section 2.1, “The Rectangular Coordinate Systems and Graphs,” especially the distance formula as derived from the Pythagorean theorem. https://openstax.org/books/college-algebra-2e/pages/2-1-the-rectangular-coordinate-systems-and-graphs
  2. Lynn Marecek and Andrea Honeycutt Mathis. Intermediate Algebra 2e. OpenStax, 2020. Section 11.1, “Distance and Midpoint Formulas; Circles,” especially the distance formula, exact-form examples, and midpoint formula. https://openstax.org/books/intermediate-algebra-2e/pages/11-1-distance-and-midpoint-formulas-circles
  3. Gilbert Strang and Edwin “Jed” Herman. Calculus Volume 3. OpenStax, 2016. Section 2.2, “Vectors in Three Dimensions,” especially Theorem 2.2 on the distance between two points in space. https://openstax.org/books/calculus-volume-3/pages/2-2-vectors-in-three-dimensions

Online and Official Sources

  1. Victoria Dominguez, Cristian Martinez, and Sanaa Saykali. “2.3: The Distance Formula.” Mathematics LibreTexts, accessed June 28, 2026. https://math.libretexts.org/Bookshelves/AppliedMathematics/CalculusforBusinessandSocialSciencesCorequisiteWorkbook%28DominguezMartinezandSaykali%29/02%3ACartesianCoordinateSystem/2.03%3ATheDistanceFormula