About This Tool
The Distance & Bearing Calculator is a free browser tool that answers two questions about positions on the Earth. Given two points, it tells you how far apart they are and the bearing from one to the other. Given one point, a bearing, and a distance, it tells you where you end up. Distances are measured along the shortest path over the WGS84 ellipsoid, the model of the Earth that GPS coordinates refer to, and bearings are true. Alongside the main figures it gives the bearing on arrival, the bearing back, the midpoint, the rhumb line (one constant compass course), and the distance on a simple sphere for comparison. Positions can be typed or pasted in decimal degrees, degrees minutes seconds, or degrees decimal minutes, set by clicking the map, or picked from the waypoints of a GPX file. Nothing is uploaded; the figures are calculated entirely in your browser.
How to Use It
- Choose the job. Between A and B measures the distance and bearing between two positions. B from a bearing & distance finds a new position from a start.
- Set Point A. Type a latitude and longitude, or paste a whole position into any box: it is read whether it is written as decimal degrees, DMS, or DDM. You can also click the map. The DD / DMS / DDM switch changes how both points are entered and shown.
- Set Point B, or the bearing and distance. For two points, enter B the same way; the switch above the map chooses which point a click sets. For a bearing and distance, type the bearing in degrees from true north (or a compass point such as NE) and the distance in kilometers, meters, miles, feet, or nautical miles.
- Or pick the points from a file. Choose Waypoints from a GPX File, or drop a .gpx file on the tool. Its waypoints are listed with an A and a B button each, and marked on the map, where a click on one uses it. You can mix the two: one point from the file and the other typed.
- Read the result. The headline shows the distance with the first and last bearings, or the position of Point B. The table below gives the rest, and the map draws the line.
- Adjust on the map. Drag a pin and every figure follows. Swap A and B turns the line round.
- Take it with you. Copy Results puts the figures on the clipboard as text. Download GPX saves both points as waypoints, with a route from A to B, for a GPS or a mapping app.
What the Figures Mean
| Figure | What it is | In practice |
|---|---|---|
| Distance | The length of the shortest path over the surface of the WGS84 ellipsoid | The straight-line distance at sea level. Not the distance by road or trail, and it ignores hills |
| Initial bearing | The direction of that path as it leaves A, in degrees clockwise from true north | The direction to set off in. Over a few kilometers it is the only bearing you need |
| Final bearing | The direction of travel on arriving at B | On a long line it differs from the initial bearing, because the shortest path curves across the meridians |
| Bearing from B back to A | The final bearing turned round by 180° | The direction to set off in for the return. It is not the initial bearing plus 180° except over short distances |
| Midpoint | The position half way along the shortest path | Equally far from A and B. It is not the average of the two latitudes and longitudes |
| Rhumb line | The path that keeps one constant bearing from A to B | Longer than the shortest path, but it can be steered on a single compass course. A straight line on a Mercator chart |
| On a sphere | The haversine distance on a sphere of radius 6,371 km | What most apps report, and what GPS track totals are added up from. It can differ from the ellipsoid figure by up to about 0.6% |
Over the distances most people navigate on foot or by vehicle, the shortest path and the rhumb line are the same line for every practical purpose, and one bearing describes it. The differences matter across oceans and continents: from New York to London the shortest path leaves on 51° and arrives on 108°, and the constant course of 78° is about 220 km longer.
Frequently Asked Questions
How accurate is the distance?
The calculation agrees with GeographicLib, the reference implementation for this problem, to within a millimeter for any two points on Earth, including points almost exactly opposite each other, where simpler methods fail. In practice the limit is the coordinates: six decimal places of a degree is about 10 cm, and a position from a phone or handheld GPS is good to a few meters. Our guide to GPS accuracy covers how far out a position can be.
Why does another calculator give a different distance?
Most calculators treat the Earth as a sphere and use the haversine formula. The Earth is flattened by about 1 part in 298, so a sphere is out by up to about 0.6%: a few meters per kilometer, depending on the latitude and the direction of the line. The On a sphere row shows that figure next to the ellipsoid one, so you can see which a given app is using. A larger difference usually means a different datum or a mistyped coordinate.
Why are the initial and final bearings different?
The shortest path between two points is part of a great circle, and a great circle crosses each meridian at a different angle unless it runs along the equator or a meridian. Following it means changing course steadily. Over 10 km in mid latitudes the change is at most about a tenth of a degree; across an ocean it can be 50° or more.
Are the bearings true or magnetic?
True: degrees clockwise from true north. A magnetic compass reads differently by the local declination. The Magnetic Declination Calculator gives it for any place and converts a bearing between true, magnetic, and grid north; our guide to topographic map navigation covers the method.
When should I use the rhumb line?
When you want to hold one course the whole way: steering by compass, or drawing a straight line on a Mercator chart. It is slightly longer than the shortest path, and the two are indistinguishable over short distances. The map shows the rhumb line as a dotted line once it is visibly different.
Which coordinate formats can I enter?
Decimal degrees (34.050120, −116.150340), degrees minutes seconds (34° 3' 0.43" N), and degrees decimal minutes (34° 3.007' N), typed into the fields or pasted whole in any of the three. For UTM, MGRS, or other grid references, convert them first with the Coordinate Converter. Positions are taken as WGS84, the datum GPS uses; our datum guide explains why that matters.
Can I pick the two points from a GPX file?
Yes. Choose Waypoints from a GPX File and the file's waypoints appear in a list, each with an A and a B button, and as dots on the map. Press A on one waypoint and B on another, or click the dots. A file with no waypoints offers the points of its routes instead; track points are not listed. With a long list, type part of a name to filter it: the list and the map show up to 500 at a time. A point picked this way can still be edited in its fields, and the results, the copied text, and the GPX download carry the waypoint names. Files must be .gpx and under 25 MB.
How do I find a point from a bearing and distance?
Choose B from a bearing & distance, set Point A, and enter the two values. Point B appears in all three coordinate formats, with the bearing on arrival and the bearing back to A. This is the calculation behind projecting a waypoint and behind dead reckoning.
Can I work out a course of several legs?
Yes, one leg at a time. After a leg, choose Start the Next Leg at B: Point B becomes the new Point A and the bearing and distance boxes clear for the next leg. To keep every turning point, download the GPX after each leg, or build the points in the Waypoint Editor.
Does the distance allow for elevation?
No. It is measured on the ellipsoid, which is close to sea level. Height adds very little to a straight-line distance: at 3,000 m the same two positions are about 0.05% further apart. Climbing between them is a different matter; for the length of an actual route, load its track into the GPX Analyzer.
Does it work across the date line and at the poles?
Yes. A line that crosses 180° longitude is measured the short way and drawn on the map in one piece. At a pole, where every direction is south (or north), the tool says how the bearing is shown. The longest possible distance is between opposite points on the globe: just over 20,000 km.
What is in the GPX file?
Two waypoints, Point A and Point B (under their own names if you picked them from a file), and a route that runs from one to the other. It opens in any GPS app or mapping program. The route has only its two ends, so a device draws it as its own straight line between them.
Are my positions sent anywhere?
No. The figures are calculated by JavaScript in your browser. The map loads its background from OpenStreetMap for the area you are looking at, as any online map does; the positions you enter and any file you load are not sent anywhere and are not stored. The tool remembers only your choice of units.
Related Tools
To change a position's format first, or to read one given as UTM or MGRS, use the Coordinate Converter. The Waypoint Editor adds the points you work out here to a GPX file. For the distance and heading of every leg of a route, the GPX Cue Sheet Generator lists them, and the GPX Analyzer gives the length of a recorded track.
Learn More
Latitude & Longitude Formats
Decimal degrees, DMS, and DDM: telling them apart
Topographic Map Navigation
True and magnetic bearings, and working with a map and compass
Roadbook Navigation Basics
CAP headings and the distances between notes
GPS Accuracy Explained
How far out a recorded position can be, and why
Request a Feature
Have an idea that would make this tool better? Post it on the feature request board and vote on what gets built next.