Binary Code and System Architecture
Technical Specification 12 min read

Understanding EXIF GPS Tags: Complete Technical Reference & IFD Guide

Explore the complete binary architecture of EXIF GPS metadata. A developer-level reference covering GPS IFD pointers, hexadecimal tag IDs (0x0000 to 0x001F), data structures, and the CIPA DC-008 standard.

MU

Muhammad Usman Riaz

Lead Full-Stack Engineer · Reviewed by GeoTagEditor Editorial Team

Executive Summary

Under the Japan Electronics and Information Technology Industries Association (JEITA CP-3451) and Camera & Imaging Products Association (CIPA DC-008-2019) standards, geographic location data is stored in an independent sub-directory known as the GPS Info IFD. Rather than storing plain text strings, EXIF utilizes typed binary structures—specifically BYTE, ASCII, and RATIONAL values. This reference manual documents the complete set of 32 official EXIF GPS tags, their hex IDs, binary formats, and memory offsets.

1. The Architecture of the GPS Info IFD

In JPEG files, EXIF metadata is encapsulated within the APP1 marker segment (bytes 0xFF 0xE1). Immediately following the 6-byte EXIF header (Exif\0\0), the metadata layout mimics a standard TIFF file structure:

  • Byte Order Header: Either II (Intel little-endian, 0x4949) or MM (Motorola big-endian, 0x4D4D).
  • IFD0 (Primary Image Directory): Stores camera manufacturer, model, orientation, and global metadata.
  • GPS Pointer Tag (0x8825): Inside IFD0, tag 0x8825 contains a 4-byte unsigned long offset pointing to the start of the GPS Info IFD.

If tag 0x8825 is missing, or points to an invalid byte offset, image decoders will report that the image has no GPS data, even if raw coordinate numbers appear elsewhere in the file.

2. Comprehensive EXIF GPS Tag Dictionary

The following table documents every official GPS tag defined under the EXIF 2.32 standard:

Hex ID Tag Name Data Type Count Description & Allowed Values
0x0000 GPSVersionID BYTE 4 EXIF GPS version. Usually 2.3.0.0 (bytes 0x02, 0x03, 0x00, 0x00).
0x0001 GPSLatitudeRef ASCII 2 'N' = North latitude, 'S' = South latitude (null-terminated).
0x0002 GPSLatitude RATIONAL 3 Three rational fractions: [Degrees, Minutes, Seconds].
0x0003 GPSLongitudeRef ASCII 2 'E' = East longitude, 'W' = West longitude (null-terminated).
0x0004 GPSLongitude RATIONAL 3 Three rational fractions: [Degrees, Minutes, Seconds].
0x0005 GPSAltitudeRef BYTE 1 0 = Sea level / above sea level, 1 = Below sea level.
0x0006 GPSAltitude RATIONAL 1 Distance in meters relative to reference in GPSAltitudeRef.
0x0007 GPSTimeStamp RATIONAL 3 Coordinated Universal Time (UTC): [Hour, Minute, Second].
0x0008 GPSSatellites ASCII Any GPS satellites used for measurement (e.g. "08" or PRN IDs).
0x0009 GPSStatus ASCII 2 'A' = Measurement active, 'V' = Measurement void/interrupted.
0x000A GPSMeasureMode ASCII 2 '2' = 2-dimensional fix, '3' = 3-dimensional fix.
0x000B GPSDOP RATIONAL 1 Dilution of Precision (DOP / HDOP / PDOP). Factor of satellite geometry.
0x000C GPSSpeedRef ASCII 2 'K' = km/h, 'M' = mph, 'N' = knots.
0x000D GPSSpeed RATIONAL 1 Speed of receiver movement.
0x000E GPSTrackRef ASCII 2 'T' = True North direction, 'M' = Magnetic North.
0x000F GPSTrack RATIONAL 1 Direction of receiver motion (bearing from 0.00 to 359.99 degrees).
0x0010 GPSImgDirectionRef ASCII 2 'T' = True North, 'M' = Magnetic North.
0x0011 GPSImgDirection RATIONAL 1 Direction the camera lens was facing when captured.
0x0012 GPSMapDatum ASCII Any Geodetic survey datum. Always "WGS-84" for modern GPS.
0x001D GPSDateStamp ASCII 11 UTC date in format "YYYY:MM:DD" (null-terminated).
0x001F GPSHPositioningError RATIONAL 1 Horizontal positioning error in meters (introduced in EXIF 2.3).

3. Understanding the RATIONAL Data Type

One of the most common stumbling blocks for developers building photo applications is that coordinates are not stored as 32-bit floating-point numbers (float or double). Instead, the TIFF specification requires a RATIONAL, which is a struct of two 32-bit unsigned integers:

struct RATIONAL {
    uint32_t numerator;
    uint32_t denominator;
};

For example, to record a longitude seconds value of 37.284, software represents this as:

Numerator   = 37284
Denominator = 1000
Calculation = 37284 / 1000 = 37.284 arcseconds

4. Client-Side JavaScript Implementation (PiexifJS)

The following code example demonstrates how GeoTagEditor constructs the GPS IFD object before serializing it into the JPEG binary header using client-side JavaScript:

// JavaScript: Building GPS IFD object client-side
function buildGpsIfd(latitude, longitude) {
    const latRef = latitude >= 0 ? "N" : "S";
    const lonRef = longitude >= 0 ? "E" : "W";

    const latDms = degToDmsRational(Math.abs(latitude));
    const lonDms = degToDmsRational(Math.abs(longitude));

    const gpsObj = {};
    gpsObj[piexif.GPSIFD.GPSVersionID] = [2, 3, 0, 0];
    gpsObj[piexif.GPSIFD.GPSLatitudeRef] = latRef;
    gpsObj[piexif.GPSIFD.GPSLatitude] = latDms;
    gpsObj[piexif.GPSIFD.GPSLongitudeRef] = lonRef;
    gpsObj[piexif.GPSIFD.GPSLongitude] = lonDms;
    gpsObj[piexif.GPSIFD.GPSMapDatum] = "WGS-84";

    return gpsObj;
}

5. Stripping the GPS IFD for Privacy

When scrubbing location data to protect user privacy, a tool must completely de-reference and remove the GPS IFD:

  • Delete the key GPS from the EXIF dictionary.
  • Remove the GPS pointer tag (0x8825) from 0th IFD.
  • Recalculate TIFF offset tables so decoders do not attempt to read orphaned bytes.

This is precisely how GeoTagEditor's "Remove GPS & Download" button works: it guarantees that all 32 GPS tags are thoroughly purged from the file header.

Frequently Asked Questions

What happens if a photo has GPSLatitude but no GPSLatitudeRef?

The file violates the EXIF 2.32 standard. Most parsers will assume 'N' (North) by default, but some mapping applications will reject the coordinates entirely or log a decoding warning. GeoTagEditor always enforces paired reference tags.

What is the difference between GPSTrack and GPSImgDirection?

GPSTrack (tag 0x000F) records the bearing of physical movement (e.g., a car or plane moving eastward at 90°). GPSImgDirection (tag 0x0011) records the compass direction the camera lens was pointing (e.g., looking out the window southward at 180°).

Can EXIF GPS tags store altitude below sea level?

Yes. Tag 0x0005 (GPSAltitudeRef) is specifically designed for this. If set to 0, altitude is above sea level. If set to 1, altitude is below sea level (e.g., photos captured near the Dead Sea or underwater scuba photography).

MU

About the Author & Technical Team

Muhammad Usman Riaz is the lead engineer behind GeoTagEditor.com. He specializes in digital image forensics, binary metadata standards (EXIF/IPTC/XMP), and high-performance client-side security tools.

Fact-Checked CIPA DC-008-2019 Published Feb 2026