GIS Tools

Language

Made withfor the GIS community

Distance Calculator

Calculate geodesic vs planar distances between points

CRS & Projections

Point 1

Point 2

Examples::

What Is a Geographic Distance Calculator?

A geographic distance calculator computes the distance between two or more points on Earth. Unlike a flat-plane ruler, it must reckon with the fact that Earth is (approximately) a sphere β€” and more precisely, an oblate ellipsoid. That single fact is why "distance between lat/lon points" is a richer question than it first appears, and why the industry distinguishes between at least four different distance formulas: planar (straight-line in projected meters), haversine (great-circle on a sphere), Vincenty (geodesic on an ellipsoid), and Karney (a modern, more numerically stable geodesic).

This tool calculates both the geodesic great-circle distance and the planar projected distance between any two geographic points, so you can immediately see how much Earth curvature affects your measurement. For a taxi ride across Manhattan the difference is negligible. For a flight from London to Tokyo the difference between a planar "ruler on Mercator" and the true great-circle distance can be thousands of kilometers. The haversine distance is the most widely used great-circle formula and is what you get by default; Vincenty is used when sub-meter accuracy matters.

Under the hood the calculator uses industry-standard math equivalent to Turf.js turf.distance(), PostGIS ST_DistanceSphere / ST_DistanceSpheroid, and GeoPy's geopy.distance.geodesic(). Everything runs client-side, meaning your coordinates β€” which might represent survey points, logistics routes, or confidential facilities β€” never leave your browser.

How Distance Calculation Works

The Haversine Formula

Haversine is the standard great-circle distance formula. Given two points with latitudes φ₁, Ο†β‚‚ and longitude difference Δλ, it computes:

a = sinΒ²(Δφ/2) + cos(φ₁) Β· cos(Ο†β‚‚) Β· sinΒ²(Δλ/2)
c = 2 Β· atan2(√a, √(1βˆ’a))
d = R Β· c

where R is the Earth's mean radius (6,371,008.8 m). The haversine formula is numerically well-behaved for all pairs of points including antipodal ones, and is accurate to about 0.5% β€” it treats Earth as a sphere, which it isn't quite. For most GIS applications that's plenty; for precise navigation and surveying you want Vincenty or Karney.

Vincenty's Inverse Formula

Vincenty's inverse formulas iterate a set of equations on the WGS84 ellipsoid to produce distances accurate to millimeters over any distance on Earth. They are slower than haversine (a few microseconds vs nanoseconds) and occasionally fail to converge for nearly antipodal points. Modern geodesic libraries use Karney's algorithm, which is always convergent and equally accurate.

Planar (Euclidean) Distance

If you are already in a projected CRS β€” UTM, State Plane, Web Mercator β€” you can compute distance with simple Pythagoras: d = sqrt((xβ‚‚βˆ’x₁)Β² + (yβ‚‚βˆ’y₁)Β²). This is fast and accurate within a single UTM zone but grossly wrong at continental scale, especially on Web Mercator which inflates distances massively near the poles.

Key Parameters and Options

Calculation Method

Pick haversine (default, fast, 0.5% accuracy), Vincenty (slower, millimeter accuracy), or planar (assumes coordinates are in a projected CRS). The tool labels each result with its method for auditing.

Units

Meters, kilometers, statute miles, nautical miles, feet, or yards. Conversion is done at the end with high precision so you don't lose significant figures.

Input Mode

Enter two coordinates for a single pair, a list of pairs for batch processing, or drop a GeoJSON file of LineString features to compute the total length of each line (sum of segment distances).

Datum

WGS84 by default. For legacy datums, reproject first via the EPSG Reprojector & Coordinate Converter.

Practical Applications

Logistics and Fleet Management

Delivery companies, ride-share services, and trucking fleets need accurate distance estimates for billing, route planning, and capacity calculations. Haversine distance gives a quick straight-line baseline, which is then compared against routed network distance for efficiency scoring. The distance calculator lets dispatchers validate individual pairs in seconds.

Airline and Maritime Navigation

Great-circle distances are fundamental to flight planning and shipping route design, because great circles are the shortest path on Earth's surface. Flight crews use them for fuel calculations; shipping lines use them for ETA estimation and fuel burn. The calculator pairs with the Great Circle Route generator for visual route planning.

Telecommunications and Radio Coverage

Cell tower planning, microwave link budgeting, and amateur radio contact verification all rely on precise great-circle distances. A 50 km link between two antennas is a very different radio budget from a 52 km link, so haversine accuracy matters.

Real Estate and Location Intelligence

"Homes within 5 miles of this school" and "restaurants within 1 km of this hotel" queries at scale rely on haversine distance for initial filtering before a more expensive network routing call. Location intelligence platforms use millions of haversine calculations per second.

Scientific Research

Ecologists tracking animal movements, oceanographers analyzing drifter trajectories, and epidemiologists mapping disease spread all depend on geodesic distance to quantify movement and diffusion over large areas. A haversine miscalculation can distort conclusions about migration range or spread velocity.

Emergency Response and Dispatch

Fire, EMS, and search-and-rescue teams use distance calculators to assign the nearest unit to an incident, compute response time estimates, and plan mutual aid boundaries. The browser-based tool lets dispatchers verify distances quickly when computer-aided dispatch is not available.

Surveying and Civil Engineering

Over short distances surveyors can use planar math, but for baselines longer than a few kilometers they need ellipsoidal distances. Vincenty or Karney formulas give millimeter accuracy on WGS84 for monument-to-monument distances.

Step-by-Step Workflow in gis.tools

  1. Open the Distance Calculator in your browser.
  2. Enter two coordinate pairs manually (lat1, lon1 and lat2, lon2) or paste a list of pairs.
  3. For LineString length, drag a GeoJSON file into the input area.
  4. Pick the calculation method β€” haversine, Vincenty, or planar.
  5. Choose the output units.
  6. Click Calculate. Results appear instantly, with both the raw number and a breakdown if you chose batch mode.
  7. Download results as CSV or copy to clipboard.

Worked Example

A maritime logistics analyst wants to compare the straight-line great-circle distance from Los Angeles (33.74 N, 118.27 W) to Shanghai (31.23 N, 121.47 E) against the Mercator "ruler distance" shown by a cheap web map. She enters the coordinates, picks haversine, and gets 10,568 km. She switches to planar with her source in EPSG:3857 (Web Mercator) and sees 22,400 km β€” more than double. This dramatically illustrates why great-circle distance matters for any long-haul calculation and why charting courses on a Mercator map is misleading. She then passes the route through the Great Circle Route tool to visualize the actual arc over the Pacific.

Common Pitfalls and Gotchas

  • Using planar distance for long-range calculations: Web Mercator distance between two transoceanic points can be off by 100% or more.
  • Confusing miles and nautical miles: Aviation and maritime use nautical miles (1852 m); everyone else uses statute miles (1609.344 m).
  • Assuming Earth is a sphere for surveying: For sub-meter precision over tens of kilometers, you need an ellipsoidal formula.
  • Forgetting altitude: Distance calculators give the horizontal distance. For drone flight planning or mountain terrain, account for elevation.
  • Incorrect longitude wraparound: Crossing the antimeridian (Β±180Β°) can confuse naive formulas. Haversine handles this correctly; some ad-hoc implementations don't.
  • Mixing datums: A WGS84 and an NAD27 point differ by tens of meters; make sure both are on the same datum before computing distance.
  • Axis order errors: Passing (lon, lat) where (lat, lon) is expected will give geographically meaningless results.
  • Not checking for identical points: Duplicate coordinates can produce NaN in some Vincenty implementations.

Tips for Best Results

  • Use haversine for general GIS work; it's fast and accurate enough.
  • Switch to Vincenty or Karney only when sub-meter accuracy matters.
  • Always verify the datum and axis order before computing.
  • For total route length, sum segment distances rather than computing end-to-end.
  • Be explicit about units when sharing results.
  • For antimeridian-crossing routes, split the line at Β±180Β° first.
  • Pair with the Area Calculator for consistent geodesic calculations on the same data.

Comparison with Other GIS Approaches

Turf.js turf.distance(), PostGIS ST_DistanceSphere / ST_DistanceSpheroid, GeoPy, and GeographicLib all provide equivalent functionality. QGIS has a measurement tool built in. ArcGIS Pro has Near and Generate Near Table tools for batch distance. Our browser calculator offers the same accuracy for single and small-batch calculations with zero install and complete privacy. For batch jobs of millions of pairs, a database is still the right place.

Performance Considerations

Haversine is essentially free β€” millions of calculations per second on modern hardware. Vincenty is about 10Γ— slower but still fast for most use cases. The limiting factor is the size of the input file your browser can load.

Data Privacy and Browser-Based Processing

All distance calculations happen in your browser. Coordinates of sensitive facilities, customer addresses, or research subjects never leave your machine. No logs, no uploads, no telemetry.

Related GIS Concepts

  • Great circle: the intersection of a sphere with a plane through its center; the shortest path on a spherical Earth.
  • Rhumb line / loxodrome: a path of constant bearing; longer than a great circle but simpler to follow with a compass.
  • Spherical law of cosines: an older great-circle formula that suffers from numerical error over short distances.
  • Vincenty's formulas: iterative ellipsoidal distance/bearing with millimeter accuracy.
  • Karney's algorithm: a modern, always-convergent alternative to Vincenty.
  • Grid distance: Euclidean distance in a projected CRS; fine for small areas.

Frequently Asked Questions

What formula does the distance calculator use?

By default, the haversine formula for great-circle distance on a sphere. Optionally Vincenty's inverse formulas for ellipsoidal accuracy, or planar Pythagoras for projected coordinates.

How accurate is haversine distance?

About 0.5% β€” Earth's equatorial and polar radii differ by ~21 km, so haversine (which uses a mean radius) is slightly off. For most GIS work it's more than accurate enough.

Can I compute the length of a LineString?

Yes β€” drop a GeoJSON file and the calculator sums segment distances to give total line length.

What's the difference between great-circle and rhumb-line distance?

A great circle is the shortest path; a rhumb line (loxodrome) is a path of constant bearing. Over long distances a rhumb line is noticeably longer than a great circle.

Which units are supported?

Meters, kilometers, statute miles, nautical miles, feet, and yards.

Related Tools on gis.tools

100% client-side processing - your data stays private and never leaves your device