MetaPurge

GPS coordinates in photos: what your camera records

A location tag is not a decimal number with a pin on a map. It is six fractions and two letters, written into a separate table inside the file and easy to read once you know the layout.

By Rajat Malik Updated 8 min read

Open a phone photo in a tag viewer and the location does not appear as one tidy decimal. It arrives as six fractions and two letters, stored in a table that sits apart from the camera settings. That table is the GPS block, and once you can read it the rest of the format stops looking arbitrary.

The block is written at capture time from the fix the device already had. It is not inferred afterwards, and it is not part of the picture. Removing it leaves every pixel exactly where it was.

Where the GPS block lives

EXIF is a set of tables called IFDs, chained by byte offsets. The first table, IFD0, holds the basic image tags and two pointers: one to the Exif sub-IFD for camera settings, one to the GPS sub-IFD. In the specification the GPS pointer is tag 0x8825.

The GPS table has its own numbering, which is why the same tag has a different number depending on where you look. GPSLatitude is tag 0x0002 inside the GPS IFD, not a tag in IFD0. The table usually opens with GPSVersionID set to 2.3.0.0.

This structure is not JPEG-specific. A PNG eXIf chunk, a WebP EXIF chunk and a TIFF file all carry the same TIFF-style tables.

Three fractions and two letters

A coordinate is stored as three rational numbers — degrees, minutes and seconds — plus an ASCII reference that gives the hemisphere. Altitude is a single rational with a separate byte for above or below sea level.

TagTypeExampleMeaning
GPSLatitude3 RATIONAL28/1, 36/1, 5064/10028 degrees, 36 minutes, 50.64 seconds
GPSLatitudeRefASCII, 2 bytesNNorth or south of the equator
GPSLongitude3 RATIONAL77/1, 12/1, 3240/10077 degrees, 12 minutes, 32.40 seconds
GPSLongitudeRefASCII, 2 bytesEEast or west of the prime meridian
GPSAltitude1 RATIONAL2160/10216 metres
GPSAltitudeRefBYTE00 above sea level, 1 below
GPSDateStampASCII, 11 bytes2026:11:19UTC date of the fix
GPSTimeStamp3 RATIONAL9/1, 41/1, 1250/100UTC time, as hours, minutes, seconds

Note the denominator. 5064/100 is 50.64 seconds, and that hundredths place is where sub-metre precision comes from. A device that writes 50/1 is recording whole seconds only, which is a coarser fix even though nothing in the tag says so.

How to read a coordinate pair

Take the latitude above: 28 degrees, 36 minutes, 50.64 seconds north. Divide the minutes by 60 and the seconds by 3600, then add them to the degrees.

28 + 36/60 + 50.64/3600 = 28.614067. The longitude works the same way: 77 + 12/60 + 32.40/3600 = 77.209000. Written as a pair, that is 28.614067, 77.209000 — latitude first, then longitude, in every mainstream tool.

The hemisphere letters are not decoration. There is no minus sign in a stored coordinate, so S and W are the only thing that separates 33.86 south from 33.86 north. Convert one without the reference and you land in the wrong hemisphere.

Some writers bend the format and put decimal degrees into the same three slots, for example 28/1, 614067/1000, 0/1. Readers cope because the arithmetic still adds up, but do not assume the middle value is always a whole number of minutes.

How precise the numbers are

One arcsecond of latitude is about 30.9 metres, since a minute of latitude is one nautical mile, or 1852 metres. Longitude narrows as you move away from the equator: a second of longitude is roughly 30.9 metres multiplied by the cosine of the latitude, so around 15 metres at 60 degrees north or south. Decimals divide further — 0.0001 degrees of latitude is about 11 metres.

Stored precision is not the same as accuracy. The fractions can carry hundredths of a second while the underlying fix is tens of metres out, particularly between tall buildings or under tree cover. When a device records it, GPSHPositioningError gives an estimated horizontal error in metres; many phones omit it.

Altitude is a single rational and is less reliable than the horizontal fix, because satellite geometry constrains height more weakly. Reading 216 metres does not mean the device knew the height to the metre.

When a phone attaches coordinates

A phone camera writes the location only if the camera app has location permission and a recent fix. Deny the permission and there is no GPS block at all — not an empty one. On iOS the fix is attached to the asset in the photo library; on Android the camera app writes it into the file, and the media store keeps a copy for searching.

Screenshots are not camera captures and normally carry no coordinates, though they can carry other text. Photos imported into a desktop editor and exported again usually keep their GPS unless the export dialog has an explicit option to remove it.

What happens after you send a photo is less predictable. Some messaging apps re-encode uploads and drop most metadata; others preserve it, and that varies by app and version, so a file that arrived through a chat proves nothing either way.

Removing GPS without breaking orientation

Deleting tag 0x8825 from IFD0 detaches the GPS table, but it does not delete the table's bytes. They stay in the file as an orphaned block that a parser can still find by walking the raw segment. A proper remover rebuilds the EXIF structure without the GPS entries rather than zeroing one pointer.

Orientation is a different tag, 0x0112, and it lives in IFD0 rather than the GPS table. Removing only location cannot affect it. Removing "all metadata" can, which is why a remover that deletes the whole EXIF segment also destroys the rotation instruction and makes portrait photos appear sideways.

The safe pattern is to drop the GPS IFD and keep a minimal EXIF block containing only orientation, or to bake the rotation into the pixels — which for JPEG means re-encoding and losing a little quality. The first option is better.

There is one more copy to check. XMP can carry the same coordinates as exif:GPSLatitude and exif:GPSLongitude, and Adobe tools write those properties alongside the binary EXIF. Removing the GPS table and leaving XMP in place can leave the location exactly where it was.

Blanked fields are not deleted fields Overwriting GPSLatitude with zeros while leaving GPSDateStamp, GPSTimeStamp and the altitude intact still describes a place and a moment. Check every tag in the block, and check XMP for a second copy.

See what your photos are carrying

Drop an image in. MetaPurge lists every tag, then rewrites the file without touching a pixel.

Open the metadata remover

Where to go next

Rajat Malik Frontend architect and the author of MetaPurge. Builds browser tools that keep files on the device, and writes about the parts of the web that leak by default. rajatmalik.dev