Skip to content
CalculatorZilo Logo
  • Home
  • CalculatorsExpand
    • Finance
    • Math
    • Health & Fitness
    • Education
    • Science
    • Real Estate
    • Chemistry
  • About Us
  • Contact Us
CalculatorZilo Logo
Home / General Calculators / Distance Calculator
Geometry Calculators

Distance Calculator

Published onSeptember 18, 2025 Updated onOctober 21, 2026 4:45 pm

How far apart are two things? It sounds like one question, but it splits the moment you try to answer it. On graph paper the answer comes from the Pythagorean theorem: the straight line between two points is the hypotenuse of a right triangle. On the surface of the Earth it comes from spherical trigonometry, because a degree of longitude spans about 111 kilometers at the equator and shrinks to nearly nothing at the poles. And on a road trip, neither answer matches the odometer, because roads refuse to travel in straight lines.

This distance calculator handles the first two jobs. Use the Two points tab for the straight-line distance between two points in 2D or 3D, with slope, midpoint, and a grid-walking Manhattan distance included. Use the Latitude and longitude tab for the great-circle distance between two GPS coordinates, with initial bearing, a 16-point compass direction, the great-circle midpoint, and every result in kilometers, miles, nautical miles, meters, and feet. Every mode shows the full step-by-step work for your own numbers, so you can check it by hand.

Distance Calculator
Straight-line distance between two points in 2D or 3D, or great-circle distance between two GPS coordinates
Dimensions: ?2D uses x and y only. Switching to 3D reveals a z field for each point; slope and Manhattan distance hide, because both are flat-plane measures.
Coordinate format: ?Decimal degrees write a coordinate as one number, like 40.7128. Degrees, minutes and seconds split it into three parts with a hemisphere letter. Both describe the same points.

Signed decimal degrees: north and east are positive, south and west are negative. Latitude must be between -90 and 90, longitude between -180 and 180.

Point 1
Point 2

Minutes and seconds must each be below 60. Latitude degrees run 0 to 90, longitude degrees 0 to 180; the hemisphere supplies the sign.

Result
Distance–
Slope–
Midpoint–
Manhattan (grid) distance–
Great-circle distance–
Miles–
Nautical miles–
Meters–
Feet–
Initial bearing–
Midpoint (great-circle)–
Central angle–

Uses the haversine formula with the mean Earth radius of 6,371.0088 km. The real Earth is slightly ellipsoidal, so very long distances can differ by up to about 0.5%.

Quick Answer

Quick answer: The calculator is pre-filled in both tabs. On the Two points tab, (1, 2) and (4, 6) are 5.0000 units apart, with slope 4/3, midpoint (2.5000, 4.0000), and a Manhattan grid distance of 7.0000 units. On the Latitude and longitude tab, New York City and Los Angeles are 3,935.75 km apart (2,445.56 miles) on a great circle, with an initial bearing of 273.7° (W). One click on Calculate distance reproduces either result.

Key takeaways

  • Flat points and GPS coordinates need different formulas: the distance formula for x and y, the haversine formula for latitude and longitude. Feeding degrees into the flat formula is the most common distance mistake.
  • Every mode shows the step-by-step work for your own numbers, including the intermediate haversine values a and c, so any result can be audited by hand.
  • The points tab bundles slope (as an exact fraction), midpoint, and Manhattan distance with the main answer. The GPS tab bundles bearing, a 16-point compass label, the spherical midpoint, and all five units at once.
  • Neither answer is a driving distance. Roads add roughly 20 to 40 percent on typical intercity routes, and the section below explains when each number is the right one.
On this page
  • Quick Answer
  • Which tab do you need?
  • How distance is calculated
  • Worked examples, checked against the tool
  • Slope, midpoint, and Manhattan: the extras in points mode
  • Straight-line distance vs driving distance
  • What other distance calculators miss
  • Three points, a point and a line, or two points in space?
  • Reference distances, checked in this calculator
  • Straight-line distance vs driving distance: a city example

Which tab do you need?

The tab choice is the whole decision. Coordinates from a graph, a CAD drawing, or a game map belong on the first tab; coordinates from a GPS device, a map pin, or a gazetteer belong on the second.

1

Two points, for flat coordinates. Choose 2D for points on a plane or 3D for points in space, enter both points, and read the distance with its slope, midpoint, and grid distance.

2

Latitude and longitude, for places on Earth. Enter the two coordinates as decimal degrees, or switch the format to degrees, minutes, and seconds if that is how your source writes them.

3

Click Calculate distance. The result box opens with the headline distance, every supporting value, and a step panel that shows each intermediate number for the inputs you actually typed.

4

Copy or share the full result. The buttons package the points, the distance, and the supporting values as plain text. Reset restores the pre-filled examples and hides the results again.

How distance is calculated

Three formulas do almost all the work, and each answers a different question.

Distance between two points in 2D

The distance between (x1, y1) and (x2, y2) is d = √[(x2 − x1)² + (y2 − y1)²]. Draw the horizontal gap and the vertical gap between the points and you have the two short sides of a right triangle; the distance you want is the hypotenuse. It is the same geometry as a rectangle's diagonal, which is why the diagonal distance calculator and this tab agree wherever they overlap. Squaring disposes of the signs, so it does not matter which point you call first: going from A to B gives the same number as going from B to A, as it should.

Distance between two points in 3D

Add a third squared difference under the same root: d = √[(x2 − x1)² + (y2 − y1)² + (z2 − z1)²]. The pattern extends to any number of dimensions, which is why the same formula does duty in statistics and machine learning as Euclidean distance.

Distance between latitude and longitude: the haversine formula

Raw latitude and longitude are angular coordinates, not flat x and y distances. Longitude lines converge toward the poles, so one degree of longitude is about 111 km at the equator but nearly zero near the poles. The haversine formula finds the great-circle distance, the shortest path over the surface of a sphere:

Haversine: a = sin²(Δφ/2) + cos φ1 × cos φ2 × sin²(Δλ/2); c = 2 × atan2(√a, √(1 − a)); d = R × c. Here φ is latitude and λ is longitude in radians, c is the central angle between the points, and R is the Earth's radius.

This calculator uses the mean Earth radius R = 6,371.0088 km, the IUGG mean radius; for scale, NASA's Earth fact sheet lists the mean radius as 6,371.0 km. The spherical formulas for distance, bearing, and midpoint follow the standard set worked through at Movable Type's latitude and longitude reference. Results are converted with 1 km = 0.621371 miles, 1 km = 0.539957 nautical miles, 1 km = 1,000 m, and 1 km = 3,280.84 ft.

Bearing and midpoint on a sphere

The initial bearing is the compass direction you would start traveling from point 1 along the great-circle route toward point 2, measured clockwise from true north: 0° is north, 90° east, 180° south, 270° west. The tool also reports the 16-point compass label (N, NNE, NE, and so on). The spherical midpoint is the halfway coordinate along the great-circle path, found with spherical trigonometry rather than by averaging latitudes and longitudes, which gives the wrong answer on long or high-latitude routes.

Worked examples, checked against the tool

Both tabs are pre-filled with the first two examples, and every figure below is what the tool returns for them, including the contents of its step panel.

Example 1: the pre-filled points, (1, 2) and (4, 6)

StepWorkingValue
dx4 − 13.0000
dy6 − 24.0000
dx² + dy²9 + 1625.0000
Distance√255.0000 units
Slopedy / dx as an exact fraction4/3 (about 1.3333)
Midpoint((1 + 4) / 2, (2 + 6) / 2)(2.5000, 4.0000)
Manhattan distance|3| + |4|7.0000 units

A second pair shows the same panel on untidier numbers: (2, 3) and (7, 11) sit 9.4340 units apart, with slope 8/5 (about 1.6000), midpoint (4.5000, 7.0000), and a Manhattan distance of 13.0000 units. And in 3D mode, (0, 0, 0) and (2, 3, 6) give dx 2, dy 3, dz 6, squares 4 + 9 + 36 = 49, and a distance of exactly 7.0000 units with midpoint (1.0000, 1.5000, 3.0000). In 3D the slope and Manhattan rows hide, because both are flat-plane ideas.

Example 2: New York City to Los Angeles

Take New York City (40.7128, -74.0060) and Los Angeles (34.0522, -118.2437). In radians: φ1 = 0.7105724, φ2 = 0.5943230, Δφ = -0.1162494, Δλ = -0.7720935.

StepWorkingValue
asin²(Δφ/2) + cos φ1 × cos φ2 × sin²(Δλ/2)0.09241091
c2 × atan2(√a, √(1 − a))0.6177596 radians
Distance6,371.0088 × 0.61775963,935.75 km
3,935.75 km
Great-circle distance NYC to LA
2,445.56
Miles (2,125.14 nautical miles)
273.7° (W)
Initial bearing from New York
39.5103, -97.1601
Great-circle midpoint, in Kansas

The remaining outputs: 3,935,751.69 m, 12,912,571.58 ft, and a central angle of 35.3950°. Entering the same cities in degrees, minutes, and seconds (40° 42' 46.08" N, 74° 0' 21.6" W and 34° 3' 7.92" N, 118° 14' 37.32" W) returns the identical 3,935.75 km, which is the cleanest way to confirm the DMS conversion: degrees + minutes/60 + seconds/3600, negative for south and west.

Slope, midpoint, and Manhattan: the extras in points mode

The points tab reports three supporting values because each answers a question people usually ask right after the distance.

Slope is the steepness of the line through the two points, rise over run, and the tool reports it as an exact fraction first: 4/3 for the pre-filled pair, not just 1.3333. A single pair gives a single slope; when a route or a roofline has many segments, the average slope calculator weighs them together. Two edge cases are handled in words rather than numbers: points with the same x give a vertical line and an undefined slope, and identical points give no line at all.

Midpoint is the average of the coordinates, (2.5000, 4.0000) for the pre-filled pair. Averaging coordinates is also the seed of a bigger idea: weight each point by its mass and the same computation becomes a balance point, which the center of mass calculator for XY coordinates works through for point masses.

Manhattan distance answers the grid version of the question: how far you travel when movement is restricted to horizontal and vertical steps, like city blocks. From (0, 0) to (3, 4) the straight-line distance is 5 but the Manhattan distance is |3| + |4| = 7. Both are correct; they answer different questions about the same two points.

Straight-line distance vs driving distance

The number this calculator produces is the geometric distance: how far apart the two positions are, not how far you would travel to get between them. Driving distance is almost always longer. Roads curve around terrain, follow property boundaries, cross rivers at bridges, and connect through the available network. Two coordinates can sit 100 km apart as a great-circle distance while the road route is 130 km because it follows highways and avoids a mountain range. Use the great-circle result for rough separation, flight-style comparison, and coordinate geometry; use a routing engine for actual travel distance and time.

The distinction matters most when a number gets quoted out of context. An airline distance, a delivery radius, and a property "distance to downtown" claim are usually great-circle figures. A fuel budget, a driver's hours estimate, or a moving quote built on the same figure will come up short, because the road network collects its toll on every route.

What other distance calculators miss

Seven leading distance pages were read end to end before this tool was built, and the gaps below are theirs, stated plainly. One of them is a wrong answer, which is worth naming first.

A worked example that is 8 km off. Calculator Doc's haversine page demonstrates the formula on New York City to Los Angeles, the same pre-filled pair used here, and prints approximately 3,944 km. The correct haversine result is 3,935.75 km, the value this tool returns and the value its step panel derives in the open (a = 0.09241091, c = 0.6177596). A calculator whose own example cannot be reproduced is asking for trust it has not earned.

calculator.net is the strongest all-rounder, with 2D, 3D, latitude/longitude in decimal and degrees-minutes-seconds, and a clickable map. But it reports a single unit per result, shows no bearing, midpoint, or slope, gives no step-by-step work for your own numbers, and has no copy or share buttons. Its formula section discusses Lambert's ellipsoidal formula without a single worked numeric example.

Pearson has the widest mode list, but point-to-line and speed/time/distance are really separate calculators wearing the same page, and it offers no bearing, no compass direction, and no all-units output.

Omni Calculator and Calculator Ultra cover 2D points only. Calculator Ultra pads the page with filler, including a history-of-Euclid section, instead of features.

calculator.name has the best 2D explainer anywhere, with step-by-step work, slope, midpoint, and exact surd forms, but it is 2D only, and the Manhattan distance it discusses in prose is never actually computed.

calculatorshub covers 2D and 3D with a handy reference table, but has no latitude/longitude mode, no step-by-step panel, and single-unit output.

revisiontown is the best standalone haversine tool, with bearing, midpoint, and selectable Earth-radius models, but it splits 2D and 3D into separate pages and accepts decimal degrees only.

Map-based tools like mapdevelopers, distancebetween.us, and trippy measure drawn paths and driving routes, which needs a live routing engine. A formula page cannot honestly do that, so this page covers the driving question in the section above instead of pretending.

This calculator closes every one of those gaps: 2D, 3D, and latitude/longitude on one page; step-by-step work for your own numbers in every mode; bearing with a 16-point compass label and a spherical midpoint alongside the geometry modes; decimal and degrees-minutes-seconds input; all five distance units at once; a computed Manhattan distance in 2D; and copy/share buttons on the results.

Three points, a point and a line, or two points in space?

This page is built for exactly two points, in a plane, in space, or on the sphere. Two nearby questions have their own tools.

When you hold three points and need every gap between them, the three sides of the triangle they form, use the distance between 3 points calculator: it runs this page's 2D formula three times, once per pair, and classifies the triangle the sides make.

When the question is how far a point sits from a line drawn through two others, the measurement is perpendicular rather than pairwise, and the distance from a point to a line calculator is the right tool. It takes the same style of coordinates and returns the shortest distance to the line itself.

Reference distances, checked in this calculator

Every row below was recomputed with the Latitude and longitude tab above, using the coordinates shown and the mean Earth radius of 6,371.0088 km that this calculator uses throughout. Enter any pair exactly as shown to reproduce its row. The figures differ slightly from tables published with a 3,959 mile Earth radius, because the radius convention differs, not because the formula does: on the New York City to Los Angeles row the difference is 0.23 km.

FromToMilesKilometersNautical miles
New York City (40.7128, -74.0060)Los Angeles (34.0522, -118.2437)2,445.563,935.752,125.14
New York City (40.7128, -74.0060)London (51.5074, -0.1278)3,461.185,570.233,007.68
London (51.5074, -0.1278)Paris (48.8566, 2.3522)213.48343.56185.51
Chicago (41.8781, -87.6298)Denver (39.7392, -104.9903)918.201,477.71797.90
Sydney (-33.8688, 151.2093)Melbourne (-37.8136, 144.9631)443.30713.43385.22
Cairo (30.0444, 31.2357)Giza (29.9792, 31.1342)7.5612.176.57

The Cairo to Giza row is there on purpose: the haversine formula stays reliable at short distances where simpler flat approximations start to drift, which is one reason navigators have used it since long before web calculators existed.

Straight-line distance vs driving distance: a city example

The reference distances above are straight-line figures: the shortest path over the surface between two coordinates. A driving distance between the same two points is always longer, because roads curve around terrain, water, and property, and connect through the network that exists. The comparison below sums up the difference, and the worked example after it shows how large the gap can be inside a single city.

Straight-line distanceDriving distance
What it measuresThe shortest path over the surface between two coordinates.The length of an actual road route, with its curves, detours, and one-way systems.
Right forFlight and passage estimates, delivery and service radii, radio and drone range, and comparing how far apart two places are.Fuel budgets, arrival times, delivery quotes, and anything an odometer will measure.
What it needsOnly the two coordinate pairs. No road data, no traffic, and no account.A live road network, which is why it comes from a directions service such as Google Maps rather than from a formula.
Typical sizeThe baseline figure. It is never a promise about travel time.Typically 20 to 40 percent beyond the straight line on intercity routes, and far more where terrain intervenes.
0.60 mi
Straight-line distance in the Central Park example
1.6 mi
Driving distance between the same two landmarks

Those two figures are an illustrative comparison from the Google Maps Platform tutorial on calculating distances, not outputs of this calculator: two landmarks across Central Park in New York City sit 0.60 miles apart in a straight line, and the driving distance between them is 1.6 miles, about two and a half times farther, because no road crosses the park. Within cities the ratio is often worse than between cities. Once you have a road distance from a directions service, the driving time calculator turns it into a trip time with breaks and an arrival estimate.

Frequently Asked Questions

In 2D: d = sqrt((x2 - x1)^2 + (y2 - y1)^2). In 3D: d = sqrt((x2 - x1)^2 + (y2 - y1)^2 + (z2 - z1)^2). Both come from the Pythagorean theorem: the straight line between the points is the hypotenuse of a right triangle built from the coordinate differences.

Only for very small local areas, and even then with caution. Longitude lines converge toward the poles, so one degree of longitude is about 111 km at the equator but far less at high latitudes. Treating degrees as flat x and y units distorts the answer. For GPS coordinates, use the haversine mode, which accounts for the Earth's curvature.

It computes the great-circle distance between two points on a sphere from their latitudes and longitudes: a = sin^2(dphi/2) + cos(phi1) cos(phi2) sin^2(dlambda/2), c = 2 atan2(sqrt(a), sqrt(1 - a)), d = R c. It is the standard choice for flight distances, GPS work, and mapping prototypes because it is numerically stable even for points very close together.

The calculator gives the geometric distance: the shortest path over the surface. Driving follows roads, which curve around terrain, cross rivers at bridges, and connect through the road network. Expect the road distance to exceed the great-circle distance by 20 to 40 percent on typical intercity routes, and far more in mountainous regions or where a ferry or border crossing intervenes.

Initial bearing is the compass heading you start with when following the great-circle path from point 1 to point 2. Great-circle routes do not hold a constant heading (unlike rhumb lines, which do but are longer), so the bearing at the start and the bearing at the finish differ, especially on long or high-latitude routes. Aircraft and ships update their heading continuously for this reason.

Switch the coordinate format to degrees/minutes/seconds and enter each part with its hemisphere. The tool converts with decimal degrees = degrees + minutes/60 + seconds/3600, applying a negative sign for south latitudes and west longitudes. For example, 40° 42' 46" N becomes 40.7128.

No. Distance is a length, so it is always zero or positive. Coordinate differences can be negative, but squaring them in the formula removes the sign. If both points are identical, the distance is exactly zero.

Manhattan distance is |x2 - x1| + |y2 - y1|: how far you travel when movement is restricted to a grid, like city blocks. Use it for grid-based routing, delivery estimates in gridded cities, and board-game or pathfinding heuristics. Use straight-line distance when movement is unrestricted.

The haversine formula treats the Earth as a perfect sphere, but the real Earth is slightly ellipsoidal: about 6,378 km radius at the equator and 6,357 km at the poles. The resulting error is up to about 0.5% on long distances. That is fine for travel planning, aviation estimates, and education; land surveying and legal boundary work need ellipsoidal methods such as Vincenty's formulae instead.

The two points share the same x value, so the line between them is vertical. Slope is rise over run, and the run is zero, which has no defined value. If both points are identical there is no line at all, and the tool says so explicitly.

Add This Calculator to Your Website

Embed the Distance Calculator on your own site. Pick a size to preview it live, then copy the code.

Powered by Calculator Zilo

References

  1. Wolfram MathWorld, "Distance" - the Euclidean distance formula in two and three dimensions, the basis of the Two points tab. MathWorld: Distance. Accessed October 2026.
  2. Chris Veness, Movable Type, "Calculate distance, bearing and more between Latitude/Longitude points" - the haversine, initial bearing, and spherical midpoint formulas used in the Latitude and longitude tab, with worked derivations. Movable Type: Latitude/Longitude Points. Accessed October 2026.
  3. NASA Goddard Space Flight Center, "Earth Fact Sheet" - the planetary data behind the mean Earth radius of about 6,371 km used in the great-circle calculation. NASA: Earth Fact Sheet. Accessed October 2026.
  4. Khan Academy, "Distance formula" - the derivation of the 2D distance formula from the Pythagorean theorem. Khan Academy: Distance Formula. Accessed October 2026.
  5. Wolfram MathWorld, "Midpoint" - the coordinate-averaging definition behind the midpoint reported in points mode. MathWorld: Midpoint. Accessed October 2026.
  6. OpenStax, Algebra and Trigonometry 2e, "The Rectangular Coordinate Systems and Graphs" - the distance and midpoint formulas in a peer-reviewed open textbook. OpenStax: Rectangular Coordinate Systems and Graphs. Accessed October 2026.

Related calculators

Geometry Calculators45 45 90 Triangle Calculator A 45-45-90 triangle is an isosceles right triangle: two equal legs meet at a right angle, and the hypotenuse is always the leg times the square root of 2.Geometry CalculatorsPerimeter Formula Calculator – Calculate Perimeter of Any Shape InstantlyGive this calculator a shape and its dimensions and it returns the perimeter with the formula written out and your numbers substituted, so you can follow every step.Geometry CalculatorsParallel Or Perpendicular CalculatorAre two lines parallel, perpendicular, or neither?Geometry Calculators30 60 90 Calculator: Solve Any Triangle FastA 30-60-90 triangle is the other special right triangle.Geometry CalculatorsSin Calculator: Free Trigonometry Tool OnlineA sin calculator should do more than one ratio.Geometry CalculatorsGeometric Formula CalculatorSix shapes account for most geometry homework and most job-site measurement questions: rectangle, circle, triangle, square, sphere and cylinder.

CalculatorZilo

Free calculators for everything. Accurate, fast, no signup.

Categories

Finance Math Health & Fitness Education Science Real Estate Chemistry Browse all calculators

Legal

Privacy Policy Terms and Conditions Disclaimer Cookie Policy DMCA Policy

Company

About Us Contact Us FAQ Accessibility Statement

We use cookies to analyze traffic and to serve ads that keep our calculators free. You can accept or decline cookies below. Learn more

© 2026 CalculatorZilo. All rights reserved.

  • Home
  • Calculators
    • Finance
    • Math
    • Health & Fitness
    • Education
    • Science
    • Real Estate
    • Chemistry
  • About Us
  • Contact Us
Search