Skip to main content

Distance Calculator - Distance Between Two Points (2D and 3D)

Euclidean distance, midpoint, and in 2D the slope (or vertical). Default (0, 0) to (3, 4) is 5.

Two Points

Default is (0, 0) to (3, 4), distance 5. Coordinates may be zero or negative. Same point gives distance 0.

Distance Result

Distance, midpoint, and (in 2D) slope will appear here

What Is a Distance Calculator and Why Do You Need One?

A distance calculator finds how far apart two points are in the Euclidean plane or in space. In two dimensions the formula is the Pythagorean theorem on the run and the rise: d = √[(x2−x1)² + (y2−y1)²]. In three dimensions you add the third square: + (z2−z1)² under the same root. The result is a length, never negative.

The default pair is (0, 0) and (3, 4). Then d = √(9+16) = 5, the classic 3-4-5 hypotenuse. The midpoint is (1.5, 2). The slope is 4/3. Coordinates may be negative; (−3, 0) to (0, 4) is still 5. Coincident points give distance 0, which is a valid measurement, not an error.

This is not geodesic distance on a map (great-circle miles), not Manhattan |Δx|+|Δy|, and not driving directions. If you only needed the slope of the segment, the slope calculator goes further (angle, intercept, equation). If you have two legs and want the hypotenuse without coordinates, use the Pythagorean theorem calculator. A full right-triangle solve with angles belongs on the right triangle calculator.

How to Use This Free Online Distance Calculator

Using this 2D 3D point distance tool takes four steps:

  1. Choose 2D or 3D. Slope is reported only in 2D. Midpoint always uses the coordinates you entered.
  2. Type both points. Empty fields wait. Non- numeric text errors. Zero is allowed.
  3. Read d, Δx Δy (Δz), midpoint, and slope (or “vertical” when x1 = x2 in the plane).
  4. Copy or clear. Points stay in localStorage for up to 30 days.

Note: there is no unit dropdown. If x is in metres, d is in metres. GPS latitude/longitude is not Euclidean without a projection; do not paste degrees here and expect kilometres.

The Distance Formula and the 3-4-5 Triangle

d = √[(x2 − x1)² + (y2 − y1)²]
Plane distance. Pythagoras on the legs |Δx| and |Δy|.

Worked example - (0, 0) to (3, 4):

  • Δx = 3, Δy = 4
  • d = √(9 + 16) = √25 = 5
  • Midpoint ((0+3)/2, (0+4)/2) = (1.5, 2)
  • Slope m = 4/3

3² + 4² = 5² is the smallest primitive Pythagorean triple besides order. Any similar segment - (1, 1) to (4, 5), still Δ = (3, 4) - has the same length 5. Multiples 6-8-10 and 9-12-15 are the same family scaled.

Worked example - vertical segment (2, 1) to (2, 7):

Δx = 0, Δy = 6, d = 6. Slope is undefined (vertical). Distance is still well-defined. A horizontal segment (1, 5) to (8, 5) has d = 7 and slope 0.

Worked example - 3D (0, 0, 0) to (1, 2, 2):

d = √(1 + 4 + 4) = √9 = 3. Midpoint (0.5, 1, 1). No slope line is printed in 3D mode because a space segment does not have a single rise/run in one plane unless you pick a projection.

2D vs 3D Distance vs Slope vs Midpoint

Quantity2D3D
Distance√(Δx²+Δy²)√(Δx²+Δy²+Δz²)
Midpointaverages of x, yaverages of x, y, z
SlopeΔy/Δx or verticalnot reported

Distance is a length ≥ 0. Slope can be negative (downhill left to right), zero (horizontal), or undefined (vertical). Midpoint is a point, not a length: (1.5, 2) is not “1.5 units of distance.” People mix these three because they all come from the same two ordered pairs.

How to Find the Midpoint of Two Points

Average each coordinate independently: M = ((x1+x2)/2, (y1+y2)/2) in the plane, and the same with z in space. For the default, M = (1.5, 2). The midpoint is the unique point on the segment equally far from both ends in Euclidean distance. It is also the centroid of a two-point set.

Section formula for a ratio other than 1:1 (dividing a segment in 2:1, for example) is not implemented. Neither is a weighted midpoint. If you need the perpendicular bisector, you already have M and, in 2D, the slope of the segment; the bisector’s slope is the negative reciprocal when the original slope exists and is nonzero - compute that on paper or with the slope tool.

Where Point Distance Shows Up in Real Work

1. Analytic geometry homework

Prove a triangle is right by checking whether the sides from three distances satisfy a²+b²=c². That is the converse of Pythagoras, using this formula three times. The default 3-4-5 is the usual first check.

2. Computer graphics and games

Collision tests often compare d² with r² to avoid a square root. This page still shows d, the actual length. Pixel coordinates may be integers; the distance can still be irrational (√2 between (0,0) and (1,1)).

3. Surveying and CAD (locally Euclidean)

On a building site a few hundred metres across, a plane approximation is fine. Across a country, use a geodesic. This calculator will not apply a map projection or WGS84.

4. Physics displacement vs path length

Distance here is the straight chord between two position vectors, i.e. the magnitude of displacement if those are start and end. A curved path between the same points is longer. Do not paste a racetrack lap into this formula.

Common Mistakes With the Distance Formula

  • Forgetting to square before adding or forgetting the square root (reporting 9+16=25 as the distance instead of 5).
  • Subtracting in the wrong order - signs of Δx and Δy flip, but squares make distance the same. Slope would flip if you swapped the points; this tool always uses point 2 minus point 1 as labeled.
  • Treating slope as distance (4/3 is not 5).
  • Using 2D mode for a 3D problem and dropping z, which understates the space diagonal.
  • Lat/long as if they were metres.

How to Calculate Distance Between Two Points Step by Step

Write the two ordered pairs. Subtract x-coordinates to get the run Δx = x2 − x1. Subtract y-coordinates to get the rise Δy = y2 − y1. Square each difference - squaring discards the sign, which is why distance does not care which point you call “first” for the length (though this UI always subtracts point 2 minus point 1 so slope keeps a direction). Add the squares. Take the principal (non-negative) square root. That root is d.

Check with a right triangle you already know. If Δx = 5 and Δy = 12, d = √(25+144) = 13. If Δx = 8 and Δy = 15, d = 17. If both differences are 1, d = √2 ≈ 1.4142135623730951, which is not 1.4 exactly and not 2. Sketching the segment on graph paper and counting diagonal boxes is a count of √2 steps, not of taxicab blocks.

Order of points: distance((A),(B)) = distance((B),(A)). Midpoint is also symmetric. Slope flips sign if you swap the labels of the two points, because rise and run both flip. This calculator does not swap them for you; x1,y1 is the first point as typed.

3D Distance Formula with a Worked Space Diagonal

A rectangular room that is 3 m long, 4 m wide, and 12 m high has a space diagonal from one lower corner to the opposite upper corner of √(9+16+144) = √169 = 13 m. That is the 3D distance formula with points (0,0,0) and (3,4,12). You can think of it as a 5 m floor diagonal (3-4-5) then a right triangle of legs 5 and 12, hypotenuse 13. The same stacking of Pythagoras is what the single square root with three terms is doing in one shot.

In 3D there is no single “slope of the segment” without choosing a plane. Direction is a unit vector (Δx, Δy, Δz)/d, which this page does not print. Polar/azimuth angles are also omitted. If you needed the shadow of the segment on the xy-plane, that shadow’s length is the 2D distance with z ignored: √(Δx²+Δy²), which is shorter than the space diagonal unless Δz = 0.

Negative z is allowed. From (0, 0, 2) to (0, 0, −3) the distance is 5, a vertical drop. Midpoint is (0, 0, −0.5). Forgetting the sign of z and typing both as positive would give distance 1, which is a different physical pair of points.

Coordinate Signs and Why Distance Is Invariant

Translating both points by the same vector does not change d: (0,0) to (3,4) is the same length as (10,10) to (13,14). Rotating the axes does not change d either; Euclidean distance is invariant under rigid motions. That is why the formula only sees differences. An origin far from the segment does not inflate the length unless you mistakenly use the coordinates themselves instead of the differences - √(x2²+y2²) is the distance from the origin to point 2, not from point 1 to point 2, unless point 1 is the origin.

Scaling the whole figure by k multiplies d by |k|. Reflecting across an axis leaves d alone. Those facts are why a CAD block moved around a drawing keeps its measured length, and why a mirrored floor plan still has the same room diagonals.

Manhattan Distance vs Euclidean Distance

Taxicab (Manhattan) distance is |Δx| + |Δy|, the length of an axis-aligned path. For the default (0,0) to (3,4) that is 7, not 5. Chessboard (Chebyshev) distance is max(|Δx|, |Δy|) = 4. Euclidean distance - this page - is the straight chord 5. Navigation apps that route on a street grid are closer to Manhattan plus one-way constraints; a bird or a laser is Euclidean. Mixing the three in a lab report will not match a key that used √(Δx²+Δy²).

In 3D the taxicab analogue is |Δx|+|Δy|+|Δz|. For (0,0,0) to (1,2,2) that is 5, while Euclidean is 3. This calculator never switches norms. If an assignment asked for “city block distance,” do not use this result.

Honest Limits of This Distance Calculator

  • Euclidean only. No Manhattan, Chebyshev, or Minkowski p-norms other than p = 2.
  • No map geodesics and no unit conversion.
  • Slope only in 2D, undefined on a vertical line or coincident points.
  • IEEE-754 square roots. Enormous coordinates can overflow before the root.
  • Two points only. No polyline length, no nearest-point-on-a-line.

Frequently Asked Questions (FAQ) - Distance Calculator

What is the distance formula?

In the plane, the distance between (x1, y1) and (x2, y2) is d = √[(x2−x1)² + (y2−y1)²], which is the Pythagorean theorem on the horizontal and vertical legs. The default (0, 0) to (3, 4) is √(9+16) = 5.

Why is (0,0) to (3,4) a 3-4-5 triangle?

The legs 3 and 4 and hypotenuse 5 satisfy 3² + 4² = 9 + 16 = 25 = 5². Any similar triple (6-8-10, 9-12-15, …) is in the 3-4-5 family. The distance calculator reports the length 5; it does not require the points to sit on the axes.

How do you find distance in 3D?

Add the third coordinate: d = √[(x2−x1)² + (y2−y1)² + (z2−z1)²]. It is again Pythagoras, now on a space diagonal. Midpoint in 3D is the average of each coordinate: ((x1+x2)/2, (y1+y2)/2, (z1+z2)/2).

How do you find the midpoint of two points?

Average the coordinates. In 2D the midpoint is ((x1+x2)/2, (y1+y2)/2). For the default (0,0) and (3,4) that is (1.5, 2). Midpoint is a point, not a length; distance is the length of the segment.

What is the difference between slope and distance?

Distance is always a non-negative length. Slope in 2D is rise over run, (y2−y1)/(x2−x1), and can be negative, zero, or undefined on a vertical line (x1 = x2). A vertical segment still has a well-defined distance |y2−y1|. This tool reports slope only in 2D mode.

Does this distance calculator upload my coordinates?

No. Distance, midpoint, and slope are computed in your browser with JavaScript. Nothing is sent to a server. After the page loads, the tool still works offline. The last points are stored only in localStorage on this device for up to 30 days.

Why Choose Our Distance Calculator?

  • Free, no account. 2D and 3D Euclidean distance.
  • Private. Coordinates never leave this browser.
  • Midpoint included every time.
  • 2D slope or an explicit vertical/coincident message.
  • Default 3-4-5 so you can see a known exact 5.
  • Works offline after the first page load.