Search for a tool
Haversine Distance

Tool to calculate the Haversine distance between two geographic points using their GPS coordinates (latitude, longitude). Easily compare distances in kilometers, miles, or nautical miles.

Results

Haversine Distance -

Tag(s) : Geography

Share
Share
dCode and more

dCode is free and its tools are a valuable help in games, maths, geocaching, puzzles and problems to solve every day!
A suggestion ? a feedback ? a bug ? an idea ? Write to dCode!


Please, check our dCode Discord community for help requests!
NB: for encrypted messages, test our automatic cipher identifier!


Feedback and suggestions are welcome so that dCode offers the best 'Haversine Distance' tool for free! Thank you!

Haversine Distance

Haversine Distance Calculator






See also: Azimuth

Answers to Questions (FAQ)

What is the Haversine distance? (Definition)

The Haversine distance (short for half of a versed sine) refers to the length of the great-circle arc between two points on the surface of a sphere, often the Earth, taking into account its curvature.

It is based on the Haversine formula, a trigonometric equation that provides a precise estimate measurement of the distance between two GPS coordinates (latitude and longitude).

How do you calculate the Haversine formula?

The Haversine formula calculates the great-circle distance between two points on the Earth's surface, given their GPS coordinates expressed in latitude and longitude.

It relies on spherical trigonometry to account for the curvature of the Earth's sphere.

From two points $ P_1 ( \varphi_1, \lambda_1 ) $ and $ P_2 ( \varphi_2, \lambda_2 ) $, expressed in radians.

The Haversine formula is: $$ d = 2r \cdot \arcsin\left( \sqrt{ \sin^2\left( \frac{\varphi_2 - \varphi_1}{2} \right) + \cos(\varphi_1)\cos(\varphi_2)\sin^2\left( \frac{\lambda_2 - \lambda_1}{2} \right) } \right) $$

where $ r $ is the radius of the reference sphere (the average radius of the Earth is approximately 6371 km)

Example: The distance between two antipodal points at opposite ends of the Earth is approximately 20015 km (whereas in a straight line, passing through the center of the Earth, the distance would be 12742 km).

What is the purpose of calculating Haversine distance?

Using the Haversine distance allows the user to measure the actual distance between two geographic locations without being limited to a planar (Euclidean) distance.

The classic Euclidean distance measures a straight path on a plane, ignoring the Earth's curvature. The Haversine distance calculates the shortest path along the Earth's sphere.

It is a method commonly used in air navigation, geodetic calculations, GPS mapping, and mobile geolocation applications.

What are the variations of the Haversine formula?

Several geodetic formulas exist for calculating distances on Earth:

— Vincenty: more precise, based on an ellipsoidal model of the Earth.

— Great-circle distance: a simplified version of the great-circle calculation without using the haversine function.

— Equirectangular approximation: a faster but less precise method, suitable for small distances.

Each variant offers a compromise between calculation speed and accuracy depending on the intended use.

When was the Haversine formula invented?

The Haversine formula was introduced in the 19th century based on the work of James Inman (1835), a British mathematician. It derives from the Haversine tables used in astronomy and navigation to simplify trigonometric calculations before the advent of calculators and computers.

Source code

dCode retains ownership of the "Haversine Distance" source code. Any algorithm for the "Haversine Distance" algorithm, applet or snippet or script (converter, solver, encryption / decryption, encoding / decoding, ciphering / deciphering, breaker, translator), or any "Haversine Distance" functions (calculate, convert, solve, decrypt / encrypt, decipher / cipher, decode / encode, translate) written in any informatic language (Python, Java, PHP, C#, Javascript, Matlab, etc.) or any database download or API access for "Haversine Distance" or any other element are not public (except explicit open source licence). Same with the download for offline use on PC, mobile, tablet, iPhone or Android app.
Reminder: dCode is an educational and teaching resource, accessible online for free and for everyone.

Cite dCode

The content of the page "Haversine Distance" and its results may be freely copied and reused, including for commercial purposes, provided that dCode.fr is cited as the source (Creative Commons CC-BY free distribution license).

Exporting the results is free and can be done simply by clicking on the export icons ⤓ (.csv or .txt format) or ⧉ (copy and paste).

To cite dCode.fr on another website, use the link: https://www.dcode.fr/haversine-distance

In a scientific article or book, the recommended bibliographic citation is: Haversine Distance on dCode.fr [online website], retrieved on 2025-12-19, https://www.dcode.fr/haversine-distance

Need Help ?

Please, check our dCode Discord community for help requests!
NB: for encrypted messages, test our automatic cipher identifier!

Questions / Comments

Feedback and suggestions are welcome so that dCode offers the best 'Haversine Distance' tool for free! Thank you!


https://www.dcode.fr/haversine-distance
© 2025 dCode — The ultimate collection of tools for games, math, and puzzles.
â–˛  
Feedback