All Over Tools logo
Tool Combiner
Analyze Tools Clean Tools Compare Tools Convert Tools Data Validation Extract Tools Format Tools Generate Tools Organize Tools Transform Tools
Audio Tools Font Tools Image Tools Subtitle Tools Video Tools
Archive Tools Document Tools Ebook Tools File Management Tools PDF Tools Presentation Tools
Config Tools Database Tools Dataset Tools JSON Tools Parser Tools Spreadsheet Tools XML Tools
Business Calculators Construction Calculators Date And Time Calculators Education Calculators Financial Calculators Food Calculators Health Calculators Math Calculators Science Calculators Sports Calculators Statistics Calculators
Blog About Us Contact Us

Distance Formula Calculator

Find the straight-line distance between two coordinate points in 2D or 3D. See the formula, every intermediate value, and a copyable, downloadable result.

Coordinates can be positive, negative, or zero. Both points must use the same unit.

This labels the result only - the calculator assumes both points are already in this same unit and does not convert between units.

How to use the Distance Formula Calculator

Choose 2D (x, y) for points on a flat plane, or choose 3D (x, y, z) when each point has a third coordinate. Enter x1, y1, x2, and y2, add z1 and z2 for 3D, select Unit, then click Calculate. The result shows each coordinate difference, its square, the sum, and the final distance.

2D and 3D distance formula

For two 2D points, (x1, y1) and (x2, y2), subtract the matching coordinates, square the differences, add them, and take the square root:

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

    The two coordinate differences form the legs of a right triangle, so this is the Pythagorean theorem applied to coordinate points. For 3D (x, y, z), include the z difference under the same square root:

      • d = sqrt((x2 - x1)^2 + (y2 - y1)^2 + (z2 - z1)^2)
      2D: d = sqrt((x2 - x1)^2 + (y2 - y1)^2)
      3D: d = sqrt((x2 - x1)^2 + (y2 - y1)^2 + (z2 - z1)^2)

      Using the example values shown in the coordinate fields:

      Point 1: (1, 2)
      Point 2: (4, 6)
      Distance: 5 Unitless (plain coordinates)

      What the Unit option changes

      Unit adds a label to the result and does not convert coordinate values. Enter both points in the same unit before you click Calculate. The choices are Unitless (plain coordinates), Millimeters (mm), Centimeters (cm), Meters (m), Kilometers (km), Inches (in), Feet (ft), Yards (yd), and Miles (mi).

      Select Unitless (plain coordinates) when the values have no physical unit. Select Meters (m), for example, when both points are already measured in meters and you want that label beside the distance.

      Which coordinates does the calculator accept?

      Enter positive, negative, zero, or decimal values. A blank field produces a required-field error. The accepted format has an optional leading minus sign and decimal digits. A leading plus sign or exponent notation does not match that format. Each coordinate must have an absolute value of 1e12 or less.

      The calculation is Euclidean distance on a flat 2D plane or in flat 3D space. Switching between 2D (x, y) and 3D (x, y, z) hides the current result and clears the current error. In 3D, fill in z1 and z2 before clicking Calculate.

      Where a distance between two points comes up

      For a worksheet check, enter (1, 2) and (4, 6), then compare Formula & steps with the hand calculation. The displayed differences and squares show where the distance of 5 comes from.

      For a 3D model, enter z1 and z2 to include depth. If the coordinates are in meters, select Meters (m); the result keeps that label when you copy or download it.

      Choosing another math calculator

      Use Midpoint Calculator for the center point between two coordinates. Use Slope Calculator for a line's slope from two points or from rise and run. Choose Geometry Calculator for several geometry measurements and a labeled diagram. Math Calculators lists the other equation, sequence, matrix, vector, and number tools.

      Frequently asked questions

      How do I calculate 3D distance?

      Choose 3D (x, y, z), enter x1, y1, z1, x2, y2, and z2, then click Calculate. The result adds the squared z difference to the 2D formula and shows it in Formula & steps.

      Can I use negative coordinates in the distance formula calculator?

      Yes. Negative coordinates, positive coordinates, zero, and decimal values are accepted when they match the input format and stay within the 1e12 magnitude limit. Use a minus sign for a negative value.

      Does Unit convert the coordinates?

      Unit adds a result label. Enter both points in the same unit before calculating; the calculator does not convert their values.

      Are my coordinates sent anywhere?

      The page script calculates from the coordinates in the browser. The page code contains no fetch, XMLHttpRequest, sendBeacon, or form submission for those values.

Related Tools

47 views