Distance Between Two Points

Calculate the straight-line (Euclidean) distance between two points on a 2D plane using their (x, y) coordinates.

Distance5
Horizontal change (Δx)
3
Vertical change (Δy)
4

Uses the Euclidean distance formula: d = sqrt((x2 - x1)^2 + (y2 - y1)^2). Coordinates can be any real numbers, including negatives and decimals.

What the Distance Between Two Points Calculator Does

This calculator finds the straight-line (Euclidean) distance between two points on a flat 2D plane. You enter the coordinates of the first point (x1, y1) and the second point (x2, y2), and it returns the shortest distance between them as a single number in the same units as your coordinates.

It is useful for students working through geometry and algebra homework, engineers and drafters checking dimensions on a coordinate grid, game and graphics developers measuring gaps between objects, and anyone reading positions off a map or chart. If your points live in plain (x, y) coordinates, this is the tool to use.

How It Works: The Euclidean Distance Formula

The calculator uses the Euclidean distance formula, which comes directly from the Pythagorean theorem:

d = sqrt((x2 - x1)^2 + (y2 - y1)^2)

The idea is simple. The horizontal gap between the points is (x2 - x1) and the vertical gap is (y2 - y1). Those two gaps form the legs of a right triangle, and the distance d is the hypotenuse. Squaring each difference removes any negative sign, adding them gives the square of the hypotenuse, and the square root returns the actual length.

Worked Example With Real Numbers

Suppose point A is (1, 2) and point B is (4, 6). Plug the values into the formula step by step:

  • Horizontal difference: x2 - x1 = 4 - 1 = 3
  • Vertical difference: y2 - y1 = 6 - 2 = 4
  • Square each: 3^2 = 9 and 4^2 = 16
  • Add them: 9 + 16 = 25
  • Take the square root: sqrt(25) = 5

Reading the Result

The distance between (1, 2) and (4, 6) is exactly 5 units. This 3-4-5 case is a clean whole-number answer, but most real coordinates produce a decimal. For example, the distance between (0, 0) and (2, 3) is sqrt(4 + 9) = sqrt(13) which is about 3.606.

The result is always zero or positive. A distance of 0 means both points are identical. The order of the points does not change the answer, because squaring makes (x2 - x1)^2 equal to (x1 - x2)^2.

Tips and Common Mistakes

Most errors come from small slips in the setup rather than the math itself. Watch for these:

  • Keep the same units. If x is in meters and y is in feet, the answer is meaningless. Convert first.
  • Subtract consistently. Use both x-values, then both y-values. Mixing an x with a y is a frequent error.
  • Mind the signs. With negative coordinates such as (-3, -1), the difference x2 - x1 might be a large positive number; let the formula handle it rather than dropping the minus by hand.
  • Do not skip the square root. (x2 - x1)^2 + (y2 - y1)^2 is the squared distance, not the distance.
  • This is 2D only. For points with a z-coordinate, you need the 3D version: d = sqrt((x2 - x1)^2 + (y2 - y1)^2 + (z2 - z1)^2).

When Euclidean Distance Is Not the Right Measure

Euclidean distance assumes a flat plane and a path with no obstacles. It is the correct choice for geometry problems and Cartesian grids, but not for every situation.

If you are measuring real-world distance between latitude and longitude points, the Earth's curvature matters and you should use a great-circle (haversine) calculation instead. If movement is restricted to a grid, such as city blocks where you can only travel along streets, the Manhattan distance |x2 - x1| + |y2 - y1| is more appropriate. Choose the formula that matches how distance is actually traveled in your problem.

Frequently asked questions

What formula is used?

The Euclidean distance formula: d = sqrt((x2 - x1)^2 + (y2 - y1)^2). It comes directly from the Pythagorean theorem applied to the horizontal and vertical differences between the points.

Can I use negative or decimal coordinates?

Yes. Each coordinate can be any real number, positive, negative, or with decimals. The distance result is always zero or positive.

What is Δx and Δy?

Δx is the horizontal difference (x2 - x1) and Δy is the vertical difference (y2 - y1). They form the two legs of the right triangle whose hypotenuse is the distance.

Does the order of the points matter?

No. Swapping the two points gives the same distance, since the differences are squared before taking the square root.