Mercator Projection Calculator

Latitude and longitude to Mercator metres and back.

  • Sphere and WGS 84
  • Web Mercator limit
  • Stretch by latitude
A small clay table with a soft clay ball and a see-through clay cylinder wrapped round it, with smooth ridges that spread apart toward the top of the cylinder.

The guide

The Mercator map keeps every angle true and pays for it in size

Mercator stretched the parallels so that a compass bearing becomes a straight line. The cost is area that balloons toward the poles, and web maps stop at 85 degrees to keep a square.

  • 5,621,521.486 metres: Web Mercator y at 45 degrees north
  • 1.414214 length stretch at 45 degrees (square root of 2)
  • 4 times area stretch at 60 degrees
  • 85.051129 degrees, where the Web Mercator map ends
  • 30,225.568 metres: sphere minus ellipsoid y at 45 degrees
Read the full guide Fold the guide 6 min · 12 sources

Wrap a sheet of paper round a ball so that it touches along the equator, and you have the start of the most famous map in the world. The hard part is the next step: deciding where each point of the ball lands on the unrolled sheet. Gerardus Mercator made a choice in 1569 that gave sailors a chart on which a course held steady against the compass draws as a straight line.

What the projection promises

Mercator’s map is a conformal cylindrical projection. Conformal means that every small shape and every angle where two lines cross is kept exactly as it is on the ground. A tiny square of coastline stays a tiny square, only larger. Cylindrical means the meridians run as parallel vertical lines and the parallels as horizontal ones, so the whole grid is made of rectangles.

That promise was the point. A line of constant bearing, called a rhumb line or loxodrome, crosses every meridian at the same angle. On Mercator’s grid the meridians are parallel, so such a line is straight, and a navigator reads the course off the chart by measuring against the vertical lines. NOAA’s chart office says most nautical charts still use the projection for exactly this reason.

The idea was not entirely Mercator’s alone. The USGS manual by John Snyder notes that Erhard Etzlaub apparently used the principle on small sundial covers in 1511 and 1513, but that it stayed obscure until Mercator developed it independently. It also says Mercator probably set the spacing by drawing, since tables of secants did not exist yet. Edward Wright later supplied the mathematics and, in 1599, published tables of cumulative secants.

The stretch, in numbers

To keep angles true while spacing the meridians evenly, the parallels have to spread apart toward the poles. At latitude phi the east to west stretch is 1 divided by cos phi, the secant. Conformality forces the north to south stretch to match it, otherwise shapes would be squashed. So the length stretch is the secant, and the area stretch is its square.

The values are easy to feel. At 30 degrees the length stretch is about 1.155. At 45 degrees it is 1.414214, the square root of 2. At 60 degrees it is exactly 2, so the area stretch is 4 times. At 80 degrees the length stretch is 5.76 and the area stretch is about 33. At 85 degrees the length is stretched 11.5 times and the area about 132 times.

Here lies the famous trouble. The 1921 publication by the Coast and Geodetic Survey warned that using the map for the world is very misleading, because the polar regions appear on a very enlarged scale. It pointed to Greenland, which looks larger than South America on the map although South America is roughly nine times larger. Snyder gives about one eighth for the same pair. The scale is true on the equator and nowhere else. Close to the equator the projection is excellent, and Snyder says it is especially suitable for conformal maps of equatorial regions. Far from it, a reader who judges size by eye will be wrong by a factor that the secant squared tells you exactly.

The formula and the limit

For a sphere of radius R, longitude difference gives x directly: x equals R times the longitude measured from the central meridian, in radians. The height needs more care. It is y equals R times the natural log of tan(pi/4 + phi/2). The same number is R times asinh of tan phi, which is the form this page uses, and its inverse is phi equals atan of sinh(y/R).

A common slip is to leave out the pi/4. The expression ln tan(phi/2) looks similar and is wrong: at 45 degrees it returns a negative number, minus 5,621,521.5 m instead of plus 5,621,521.486 m on a sphere of radius 6,378,137 m. Another slip is to mix degrees and radians: the angle has to be converted before the tangent is taken. The hyperbolic functions Math.asinh, Math.atanh and Math.sinh, which MDN documents, work on plain numbers and never see an angle.

The height grows without end. Because y depends on the secant, which blows up at 90 degrees, the poles sit infinitely far away and a Mercator map cannot show them. The page therefore refuses latitudes above 89.9 degrees, and at 89.9 degrees on a 6,378,137 m sphere y is already about 44,927 km.

Web maps solve the problem by cutting the map off. The latitude atan(sinh(pi)), which is 85.0511287798 degrees, is where y becomes pi times R. That equals x at 180 degrees of longitude, so the world fits in a square of side 2 pi R, which is 40,075,016.686 m. The Wikipedia article quotes the same cut-off as 85.051129 degrees.

Sphere or ellipsoid

The Earth is not a sphere. It is slightly flattened, and the WGS 84 model describes that with a semi-major axis of 6,378,137 m and an inverse flattening of 298.257223563. A conformal map of the ellipsoid needs a longer formula. The height becomes a times the difference between atanh(sin phi) and e times atanh(e sin phi), where e is the eccentricity, the square root of f times (2 minus f).

Going back is harder, because the latitude sits inside the equation on both sides. This page repeats a fixed-point step, starting from the sphere answer, until the change drops below 1e-13 degrees. Measured over 20,000 random latitudes it settles in at most seven steps. The PROJ documentation describes a different scheme that it says converges in no more than two iterations, so there is more than one way to do it.

The ellipsoid changes the numbers by a surprising amount. At 45 degrees north the sphere gives y equal to 5,621,521.486 m and the ellipsoid gives 5,591,295.919 m. The difference is 30,225.568 m, a bit over 30 km. At 60 degrees it grows to 37,039.341 m. The length stretch also moves: at 45 degrees it is 1.411845 on the ellipsoid against 1.414214 on the sphere.

Web Mercator mixes the two worlds on purpose. Its formulas are the spherical ones with the WGS 84 equatorial radius, but the coordinates fed to them are latitudes and longitudes on the WGS 84 ellipsoid. Wikipedia explains that this makes the projection slightly non-conformal, and that mistaking it for the true ellipsoidal Mercator can put points up to about 40 km out on the ground. The PROJ documentation marks it as non-conformal when used with an ellipsoid.

Its identifier is EPSG:3857. PROJ gives a worked example: longitude 2, latitude 49 on the WGS 84 datum gives 222638.98 and 6274861.39 metres. Entering 49 and 2 in the Web Mercator model reproduces both numbers to the centimetre, a check made while building this page.

A worked example, and what it cannot do

Try latitude 45, longitude 10 and the Web Mercator model. The page returns x equal to 1,113,194.908 m, which is ten degrees of longitude on a sphere of radius 6,378,137 m, and y equal to 5,621,521.486 m. Switch to the ellipsoid and y falls to 5,591,295.919 m while x stays put, because longitude is spaced the same way in both.

Now enter x and y in the reverse direction and the latitude comes back as 45 degrees. A round trip like that is the quickest test of any implementation. Over thousands of random latitudes the page returns each one to within a few parts in 1e13 of a degree, well inside the 1e-9 degree limit it sets itself.

A rhumb line is not the shortest path. Over long distances a great circle route is shorter, and the difference between the two depends on latitude, bearing and the length of the trip. A Mercator chart still draws the rhumb line straight, which is why long flights and ocean crossings look curved when drawn on one.

Several jobs lie outside this tool. It does not convert between datums, it does not build transverse Mercator or UTM zones, it does not turn coordinates into other projections and it does not compute distances. It also treats the central meridian only as a shift in x. The heavy parts, the batch list and the table, run in a web worker so the page stays responsive, which is a property of the browser rather than the maths.

Sources

Every source consulted for this guide. Links checked November 10, 2026.

  1. Mercator projection Wikipedia (CC BY-SA)
  2. Web Mercator projection Wikipedia (CC BY-SA)
  3. Map projections: A working manual (Professional Paper 1395) U.S. Geological Survey, John P. Snyder, 1987
  4. Nautical Cartography NOAA Office of Coast Survey
  5. Elements of Map Projection with Applications to Map and Chart Construction (Special Publication No. 68) U.S. Coast and Geodetic Survey, Deetz and Adams, 1921
  6. Path discrepancies between great circle and rhumb line NASA Technical Reports Server, Rajan Kaul, Ohio University
  7. Mercator (PROJ 9.9.0 documentation) PROJ contributors (MIT licence)
  8. Web Mercator / Pseudo Mercator (PROJ 9.9.0 documentation) PROJ contributors (MIT licence)
  9. Math.asinh() - JavaScript MDN Web Docs (CC BY-SA)
  10. Math.atanh() - JavaScript MDN Web Docs (CC BY-SA)
  11. Math.sinh() - JavaScript MDN Web Docs (CC BY-SA)
  12. Web Workers API MDN Web Docs (CC BY-SA)