EPSG 4326 vs EPSG 3857 (projections, datums, coordinate systems, and more!)

TL;DR: If you ever wondered what the difference was between EPSG:4326 and EPSG:3857, read on. If you want to learn about datums and projections and coordinate systems, read on. If you like silly drawings, read on!

Another note: this was originally written as a devlog for my colleagues at Mapbox, so if any of the grammar or word choices feel strange, it’s because I didn’t edit the content 100% accurately. It’s okay. You can deal with it.

Maps do a lot of cool things, but there is one that makes them indispensable: maps allow us to communicate about location using a common framework. Without this common framework, maps would not be nearly as useful – for instance, relative distance would be near impossible to measure and share.

But maps don’t provide just one single system for communicating about locations and measuring distance – there are literally infinite ways to talk about distances and locations on the earth’s surface. These are called coordinate systems and they determine not only how maps look, but also how data is stored and how distance is calculated.

In web/mobile mapping, we use two main coordinate systems for our work: EPSG:4326 (WGS 84) and EPSG:3857 (Web Mercator). This post explains what coordinate systems are, why we use these two in particular, and how to understand their differences.


The study of the measuring the earth is called geodesy. Here are things you should know about geodesy:

  1. Contrary to some descriptions, the earth is not a sphere, nor is it a spheroid, nor is it an ellipsoid. These approximations can be useful, but in reality the earth is its own crazy wonky lumpy shape that is constantly changing in four dimensions with mass movements and human behavior. It also has inconsistent density (and thus an inconsistent gravitational pull), making it even harder to model.

    The real shape of the earth is too complex to be useful as a reference for measurement.

  2. Instead, we use a reference ellipsoid as an approximation of the surface of the earth. A reference ellipsoid is a mathematically-defined surface that roughly matches the model of the earth when its topographical features are removed (the lovely lumpy geoid, a model of the earth with assumed equal density).

  3. There is not a single canonical ellipsoid that is used to measure the earth at every location. Because a reference ellipsoid is an approximation, there are locations where an ellipsoid exactly matches the geoid and there are locations where an ellipsoid is way way off. In some of these locations, a different reference ellipsoid is used that better matches the earth’s surface at those locations.

Coordinate systems

By defining a reference ellipsoid, we now have a shape on which we can place a coordinate system. A coordinate system defines locations on that surface that can be used as reference points for measurement. This is huge — imagine trying to tell someone how to get to your house without using miles, meters, or any other standardized system of measurement. Imagine trying to assess property values without the concept of acres and square footage. A coordinate system is a way to standardize the way we describe locations on a map. It’s the common understanding that allows a person to go out in the world, measure some stuff, and know with confidence that the measurements they took will show up in the right place on any map that anyone creates with that data.

There are two types of coordinate systems: geographic coordinate systems and projected coordinate systems.

Geographic coordinate systems

Geographic coordinate systems use the three-dimensional model of the earth (ellipsoid) to define specific locations on the surface to create a grid. When we refer to locations using “longitude” (East/West measurement) and “latitude” (North/South measurement), we are using geographic coordinates.

Datums, on the other hand, are geographic coordinate systems based on a specific ellipsoid (so a more specific geographic coordinate system), with an origin at a specific location, and the ellipsoid at a specific orientation. These are also called “spatial reference systems” or “coordinate reference systems.” Datums are super important: every map and spatial dataset has one, and there are multiple datums that are commonly used in different locations on the planet. Some of these datums are accurate only in certain locations in the world, as the ellipsoid they’re using is a great fit for the real earth surface in those locations, but may be way way off in other places.

Fortunately, as I describe below, you rarely have to worry about this when working with digital data, as most software has tools for detecting datums.

To reiterate, this is important because it creates a common system for talking about locations on the planet… which enables the rest of the mapping process. For more on this, the National Geodetic Survey has some excellent videos about geodetic datums. Highly recommend.

Projected coordinate systems

Projected coordinate systems are like geographic coordinate systems, but one step removed. A projected coordinate system is also a grid used as a reference for locations on the planet, but it’s a translation of the three-dimensional grid onto a two-dimensional plane (like a paper map or your screen).

One way to visualize it is to imagine a light emanating out from the center of that reference ellipsoid, and a piece of paper is wrapped around that ellipsoid, whether in a cone, or in a cylinder, or some other shape. The places where the shadows from the coordinates appear on that piece of paper defines the projection, and when you unwrap the paper and lay it flat again, those points the coordinate system for your projected data.

A projected coordinate system defines how to draw geographic locations from the three-dimensional model on a two-dimensional plane (which is much easier to fold up in your pocket and carry around than a globe) – it’s the mathematical definition of a “projection.”

A classic source for learning more about map projections: The West Wing. If you haven’t watched this clip, watch it. If you have watched it before, watch it again. I’ll wait.

Okay so, what about web maps?

The two most relevant coordinate systems to folks who work on web mapping are EPSG:4326 (WGS84) and EPSG:3857 (Pseudo-Mercator). Whether you know it or not, you’re interacting with these two coordinate systems every day.

Quick note on naming: coordinate systems (projected and geographic) are often identified by an EPSG code. EPSG stands for European Petroleum Survey Group, an organization involved in best practices for surveying and applied geodesy. In 2005, EPSG was absorbed into the International Association of Oil & Gas Producers (IOGP), but the list of coordinate systems they maintained is still called the EPSG Geodetic Parameter Dataset.

EPSG:4326 (WGS84)

The World Geodetic System of 1984 is the geographic coordinate system (the three-dimensional one) used by GPS to express locations on the earth. WGS84 is the defined coordinate system for GeoJSON, as longitude and latitude in decimal degrees. For the most part, when you describe a lon/lat coordinate location, it’s based on the EPSG:4326 coordinate system. This is how we store data at Mapbox.

There is no way to visualize the WGS84 coordinate system on a two-dimensional plane (map), so most software programs project these coordinates using an equirectangular projection (Plate-Carrée) (Esri uses EPSG:54001).

EPSG:3857 (Pseudo-Mercator)

The projected Pseudo-Mercator coordinate system takes the WGS84 coordinate system and projects it onto a square. (This projection is also called Spherical Mercator or Web Mercator.) But not all of it – the bounds of Pseudo-Mercator are limited to approximately 85.06º North and South latitude. This projection was first introduced by Google and is used in almost 100% of web maps, but it’s a strange one: the projection uses the WGS84 coordinate system, which uses the WGS84 ellipsoid, but projects the coordinates onto a sphere.

This method results in a square-shaped map (which computers really want) but there is no way to programmatically represent a coordinate system that relies on two different ellipsoids, which means software programs have to improvise. And when software programs improvise, there is no way to know if the coordinates are consistent across programs. This makes EPSG:3857 great for visualizing on computers (have I mentioned computers dig squares) but not reliable for data storage or analysis. (Fun fact: This is why we store data in EPSG:4326, but display it in EPSG:3857!)

If you’re interested in learning more about the mathematical side of EPSG:3857, read this entire blog post.

Web mapping data

For the most part, web maps rely on data stored with WGS84 coordinates (in some programs this is called “unprojected” data) and then visualize the data using Pseudo-Mercator. But sometimes, a mapper will say they want to see their data visualized in the WGS84 projection (or perhaps they refer to it as EPSG:4326). As mentioned above, WGS84 is unprojected — there is no visual representation of that data. So if someone says they want to see their data in WGS84, really they want to see their data in a Plate-Carrée projection, which essentially creates a linear Cartesian graph on the page.

Some interesting extra credit history on using Platte-Carré to visualize unprojected data from Wikipedia:

In particular, the plate carrée has become a standard for global raster datasets, such as Celestia and NASA World Wind, because of the particularly simple relationship between the position of an image pixel on the map and its corresponding geographic location on Earth.

WOW that is a lot of information about something seemingly small

I hope this was informative and useful — if anything is confusing, or if you want to chat more about this, please let me know! Special thanks to my colleague Anand for bringing up this topic the other day, and my colleauges Charlie and Dan for providing some much-needed feedback and edits.

See also

These resources are great for learning more: