Find the straight-line distance and midpoint between two points in 2D or 3D coordinate space, with the formula shown.
Enter two 2D points to find the distance and midpoint between them
Enter two 3D points to find the distance and midpoint between them
This distance calculator finds the straight-line distance and the midpoint between two points in 2D (x, y) or 3D (x, y, z) coordinate space, using the distance formula derived directly from the Pythagorean theorem. Whether you need a distance between two points calculator for a geometry class, a coordinate distance calculator for a graphics or navigation project, or a 3D distance calculator that adds depth to the equation, this free tool computes both the distance and the midpoint instantly and shows the fully substituted formula behind every answer.
The distance formula measures the length of the straight line ("as the crow flies") connecting two points, regardless of any obstacles or curved paths between them. In 2D it treats the horizontal and vertical coordinate differences as the two legs of a right triangle and solves for the hypotenuse; in 3D it simply adds a third leg for depth or height.
This tool is built for students learning coordinate geometry, game developers and graphics programmers computing object distances, GIS and mapping professionals working with grid coordinates, data scientists calculating Euclidean distance for clustering or nearest-neighbor algorithms, and engineers or designers who need a quick, accurate straight-line distance and midpoint between two known points.
Because it's a direct extension of the Pythagorean theorem, the distance formula is one of the most reused equations in applied math — it underlies GPS distance estimates, collision detection in video games, clustering algorithms in machine learning, and countless CAD and engineering measurements. A single formula scales cleanly from 2D screens to 3D physical or virtual space.
Game engines use it to detect when two objects are close enough to collide. Mapping software uses a flat-plane version of it for short local distances. Physicists use it to compute displacement between two positions. CAD and design software use it to find the length of a diagonal or the center point of a line segment. Data scientists use Euclidean distance — the exact quantity this calculator computes — as a core metric in k-means clustering and k-nearest-neighbors algorithms.
How this calculator turns two points into a distance and a midpoint
Each coordinate difference acts as a leg of a right triangle; the distance is simply the hypotenuse of that triangle.
Because differences are squared, swapping point 1 and point 2 always gives the exact same distance.
The midpoint simply averages each corresponding x, y (and z) coordinate independently — no square roots involved.
From choosing 2D or 3D to reading your result
Choose the 2D tab for points with only x and y coordinates, or the 3D tab if a z-coordinate (depth or height) is part of the problem.
Type the x₁, y₁ (and z₁ for 3D) values for your first point. Negative and decimal values are both accepted.
Type the x₂, y₂ (and z₂ for 3D) values for your second point.
The calculator subtracts, squares, sums, and takes the square root of the coordinate differences automatically.
Review the straight-line distance and the midpoint coordinates, along with the substituted formula shown beneath them.
Finding the 2D distance and midpoint between (1,2) and (4,6)
Two points on a coordinate grid: Point A at (1, 2) and Point B at (4, 6). What is the straight-line distance between them, and what point lies exactly halfway between them?
Explanation: Notice this is the same 3-4-5 right triangle from the Pythagorean theorem — the horizontal difference (3) and vertical difference (4) are the two legs, and the distance (5) is the hypotenuse. This is exactly why the distance formula is described as "the Pythagorean theorem in coordinate form."
What the distance and midpoint values actually represent
| Result | What It Means | Example Reading |
|---|---|---|
| Distance (d) | The straight-line length connecting the two points, in your input unit | d = 5 → the points are 5 units apart |
| Midpoint | The point exactly halfway between the two given points on each axis | (2.5, 4) → equidistant from both endpoints |
| Distance = 0 | Both points share identical coordinates | Only occurs when point A equals point B exactly |
Reading the sign: distance is always reported as a non-negative value, since it comes from a square root of a sum of squares — there's no such thing as a "negative distance."
Typical ranges: distance can be any non-negative real number, from 0 (identical points) up to arbitrarily large values depending on how far apart your coordinates are.
Manual verification: plug the computed distance back into d² = (x₂−x₁)² + (y₂−y₁)² and confirm both sides match — this is the fastest way to sanity-check any distance-formula answer by hand.
Where finding a straight-line distance between two points is genuinely useful
Check distance and midpoint problems from a coordinate plane step by step.
Estimate straight-line distance between two nearby coordinates on a local grid.
Detect collisions or measure distances between objects in 2D or 3D scenes.
Compute the displacement vector's magnitude between two positions.
Find the length of a diagonal or the exact center point of a line segment.
Compute Euclidean distance for clustering, k-nearest-neighbors, and similarity metrics.
Measure straight-line spans between two known reference points.
Calculate pixel distances between elements for drag-and-drop or animation logic.
Determine distances between points in a 3D scene, model, or simulation space.
Get a rough straight-line baseline distance before applying real travel routing.
Measure similarity or dissimilarity between two data points in feature space.
Verify diagonal or span measurements between two coordinate points on a plan.
What this distance calculator does well, and where it doesn't apply
The same core formula, extended with one extra coordinate
| Mode | Formula | Use When |
|---|---|---|
| 2D Distance | d = √((x₂−x₁)² + (y₂−y₁)²) | Points only have horizontal and vertical position |
| 3D Distance | d = √((x₂−x₁)² + (y₂−y₁)² + (z₂−z₁)²) | Depth, height, or altitude is also relevant |
| Great-Circle (not this tool) | Haversine formula | Long-distance latitude/longitude on Earth's curved surface |
Summary: This distance calculator gives you an instant, free way to find the straight-line distance and midpoint between two points in 2D or 3D coordinate space, with the formula and steps shown. Pair it with related tools like the Pythagorean Theorem Calculator and Slope Calculator for a fuller picture of coordinate geometry.
Common questions about the distance formula
Trusted educational references to go deeper on coordinate geometry
Explore other geometry tools