GPX file format
GPX (the GPS Exchange Format) is an open XML schema for describing geographic data — waypoints, tracks, and routes — in a vendor-neutral way. The format ships in two versions: GPX 1.0, published in 2002, and GPX 1.1, published in August 2004 and still the current default. Files use the .gpx extension, declare the GPX namespace http://www.topografix.com/GPX/1/1, follow a strict XML structure, and validate against an XSD schema published by TopoGrafix.
GPX format specification overview
GPX is a profile of XML 1.0, defined by an XSD (XML Schema Definition) hosted at topografix.com/GPX/1/1/gpx.xsd. The schema is openly published; the format has not had a major version bump since 2004 and is now considered stable.
GPX 1.0 (2002). The original release. It allowed extensions inline as siblings of standard elements, and carried speed and course on track points. The namespace URI is http://www.topografix.com/GPX/1/0.
GPX 1.1 (2004). Tightened type definitions, introduced a formal <extensions> wrapper for vendor data, and dropped the inline speed/course on track points (those moved into extensions). The namespace URI is http://www.topografix.com/GPX/1/1.
Both versions remain in use because old devices and pre-2004 archives still emit 1.0. Modern software emits 1.1 by default. Parsers should handle both — at the file level, the only difference is the value of the version attribute and the namespace URI on the root.
XML structure
A GPX file has a fixed top-level shape. The schema requires <gpx> as the root, with optional <metadata> followed by zero or more <wpt>, <rte>, and <trk> elements in that order. The annotated outline below shows the hierarchy (ellipses indicate child content omitted for clarity).
<?xml version="1.0" encoding="UTF-8"?>
<gpx version="1.1" creator="..." xmlns="http://www.topografix.com/GPX/1/1">
<metadata>...</metadata> <!-- file-level info: name, time, bounds -->
<wpt lat="..." lon="...">...</wpt> <!-- standalone waypoint (POI) -->
<rte> <!-- planned route -->
<name>...</name>
<rtept lat="..." lon="...">...</rtept>
</rte>
<trk> <!-- recorded track -->
<name>...</name>
<trkseg> <!-- track segment -->
<trkpt lat="..." lon="...">
<ele>...</ele>
<time>...</time>
</trkpt>
</trkseg>
</trk>
</gpx>
Element order is enforced by the schema: <metadata> first, then waypoints, then routes, then tracks. Child elements within <trkpt> also follow a specific sequence (<ele> before <time>, and so on). Validators that follow the XSD will flag out-of-order children.
Coordinates are decimal degrees. Latitude is bounded by ±90, longitude by ±180. Elevation is meters above the WGS84 ellipsoid; negative values (Death Valley, the Dead Sea, the inside of a salt mine) are valid.
Required and optional elements
The table below lists the elements and attributes most parsers need to handle. "If parent" means the field is required when its parent element is present (for example, every <trkpt> needs latitude and longitude). The full XSD includes additional fields like magvar, geoidheight, and the DGPS fields, which are valid but rarely written.
| Element / attribute | Required | Description |
|---|---|---|
| <gpx> | Yes | Root element of every GPX file |
| <gpx version=…> | Yes | Must be "1.0" or "1.1" |
| <gpx creator=…> | Yes | Name of producing software or device |
| <gpx xmlns=…> | Yes | GPX namespace URI |
| <metadata> | Optional | File-level metadata block (1.1 only) |
| <metadata>/<name> | Optional | File name |
| <metadata>/<desc> | Optional | Description |
| <metadata>/<author> | Optional | Author information |
| <metadata>/<time> | Optional | ISO 8601 timestamp |
| <metadata>/<bounds> | Optional | Geographic bounding box |
| <wpt> | Optional | Standalone waypoint (POI) |
| <wpt lat=… lon=…> | If parent | Waypoint coordinates (decimal degrees) |
| <wpt>/<ele> | Optional | Elevation in meters |
| <wpt>/<time> | Optional | ISO 8601 timestamp |
| <wpt>/<name> | Optional | Waypoint name |
| <wpt>/<sym> | Optional | Icon symbol name |
| <rte> | Optional | Planned route |
| <rte>/<rtept lat=… lon=…> | If parent | Route-point coordinates |
| <trk> | Optional | Recorded track |
| <trk>/<name> | Optional | Track name |
| <trk>/<trkseg> | Optional | Track segment (zero or more per track) |
| <trk>/<trkseg>/<trkpt lat=… lon=…> | If parent | Track-point coordinates |
| <trk>/<trkseg>/<trkpt>/<ele> | Optional | Elevation |
| <trk>/<trkseg>/<trkpt>/<time> | Optional | ISO 8601 timestamp |
| <extensions> | Optional | Vendor-specific data (1.1 only) |
Common extensions
GPX 1.1's <extensions> element is a wrapper for namespaced data outside the core schema. Each vendor declares an XML namespace and writes their extension elements inside.
Garmin TrackPointExtension v1. Namespace http://www.garmin.com/xmlschemas/TrackPointExtension/v1. The most widely used extension. Adds heart rate (<gpxtpx:hr>), cadence (<gpxtpx:cad>), air temperature (<gpxtpx:atemp>), water depth (<gpxtpx:depth>), and speed.
Garmin TrackPointExtension v2. Namespace ends in /v2. Adds water temperature (<gpxtpx:wtemp>), course (<gpxtpx:course>), and bearing. Backward-compatible with v1: a parser that knows v1 can ignore the v2-only fields.
PowerExtension. Cycling power data, written as watts inside <power:PowerInWatts>. Used by power-meter-equipped Garmin Edges and a handful of third-party apps.
ClueTrust GPX extensions. Legacy extension set still seen on older Garmin units and some geocaching workflows. Mostly superseded by the TrackPointExtension namespaces.
Rolling your own extension. Pick a namespace URI you control (a domain you own, plus a path), declare it on the root <gpx> element with an xmlns:yourprefix attribute, and write your elements inside an <extensions> block. There is no central registry — namespaces are first-come, first-served by URI ownership. The convention is to publish a short specification or XSD at the namespace URI so other parsers can document what they are seeing.
A parser that does not recognize an extension simply ignores it — that is the whole reason the extensions wrapper exists. Adding a new namespace never breaks existing readers; it just adds optional data for ones that opt in.
A complete GPX 1.1 example file
Below is a complete, valid GPX 1.1 file: metadata, two waypoints, and one track with three points (the first carrying heart-rate, cadence, and temperature inside a TrackPointExtension block). Drop this into the viewer further down to see it render.
<?xml version="1.0" encoding="UTF-8"?>
<gpx version="1.1" creator="viewmygpx"
xmlns="http://www.topografix.com/GPX/1/1"
xmlns:gpxtpx="http://www.garmin.com/xmlschemas/TrackPointExtension/v1"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.topografix.com/GPX/1/1
http://www.topografix.com/GPX/1/1/gpx.xsd">
<metadata>
<name>Half-day loop in the Cotswolds</name>
<desc>An 8-kilometer loop with a tea stop halfway.</desc>
<author><name>viewmygpx</name></author>
<time>2026-04-25T08:00:00Z</time>
<keywords>hiking, walking, cotswolds</keywords>
<bounds minlat="51.832" minlon="-1.838" maxlat="51.851" maxlon="-1.812"/>
</metadata>
<wpt lat="51.832" lon="-1.838">
<ele>183</ele>
<name>Trailhead</name>
<sym>Parking</sym>
</wpt>
<wpt lat="51.846" lon="-1.821">
<ele>207</ele>
<name>Tea House</name>
<sym>Restaurant</sym>
</wpt>
<trk>
<name>Loop</name>
<type>hiking</type>
<trkseg>
<trkpt lat="51.832" lon="-1.838">
<ele>183</ele>
<time>2026-04-25T08:00:00Z</time>
<extensions>
<gpxtpx:TrackPointExtension>
<gpxtpx:hr>92</gpxtpx:hr>
<gpxtpx:cad>0</gpxtpx:cad>
<gpxtpx:atemp>14.5</gpxtpx:atemp>
</gpxtpx:TrackPointExtension>
</extensions>
</trkpt>
<trkpt lat="51.835" lon="-1.832">
<ele>187</ele>
<time>2026-04-25T08:01:30Z</time>
</trkpt>
<trkpt lat="51.846" lon="-1.821">
<ele>207</ele>
<time>2026-04-25T09:30:00Z</time>
</trkpt>
</trkseg>
</trk>
</gpx>
Validating GPX files
Validation checks two things: that the file is well-formed XML, and that it conforms to the GPX schema. Most viewers do the first check implicitly while parsing; the second requires an XSD-aware tool.
xmllint. Part of libxml2 and ships on most Linux distros and macOS. Validate against the published schema with xmllint --schema https://www.topografix.com/GPX/1/1/gpx.xsd file.gpx --noout. Exits zero on success.
GPSBabel. The Swiss-army-knife format converter warns on invalid input as it reads. Useful for the "does this file even parse?" check without standing up an XSD validator.
Browser parsers (DOMParser). Catch well-formedness errors but not schema violations. The viewmygpx parser falls into this category — it surfaces malformed XML as a structured error but does not enforce the full XSD. Schema-strict validation is overkill for most user-facing flows; well-formedness is what matters when the goal is rendering the route.
Online validators. Several web-based XML validators accept the GPX 1.1 XSD as input alongside the file under test, including the W3C XML Validator and a handful of GPX-specific tools. They are convenient for ad-hoc checks but are not a fit for batch validation of a large archive — for that, scripted xmllint or GPSBabel is faster and reproducible.
Common validation failures. Unclosed tags, non-numeric latitude or longitude, missing namespace on the root element, invalid time strings (anything not ISO 8601), and content out of schema-required order. Off-by-one ordering of <ele> and <time> inside a track point is a frequent culprit on hand-edited files — the schema requires a specific order even though parsers vary in how strictly they enforce it.
Common errors and fixes
Not well-formed XML. Usually a corrupted file, a wrong character encoding, or a half-finished export. Re-export from the source app; if that fails, open the file in a text editor and look for unclosed tags or stray characters before the <?xml declaration.
Missing namespace. The root <gpx> element lacks an xmlns attribute. Some parsers tolerate this; strict ones reject it. Add xmlns="http://www.topografix.com/GPX/1/1" to fix.
Wrong version. Some niche tools emit version="2.0" or other invalid values. Schema-strict parsers reject the file; tolerant parsers may ignore the attribute. Set the version to 1.1 and the namespace to match.
Empty extensions. A vendor wrote <extensions/> with nothing inside. Harmless but ugly. Either remove the element or populate it.
Invalid time format. Timestamps must follow ISO 8601 — typically YYYY-MM-DDTHH:MM:SSZ with a Z for UTC. Local-offset timestamps with explicit +HH:MM are valid; bare strings like 2026-04-25 08:00 are not. Convert to ISO 8601 in the source software.
Missing elevation on some points. Common with phone GPS recordings without barometric sensors. Backfill via a digital elevation model — the GPSVisualizer elevation tool is the easiest path: paste your GPX, get back a version with SRTM elevation values filled in. Komoot's upload also recomputes elevation server-side. The viewmygpx viewer surfaces an "Add elevation" link when it detects a file with missing or zero-only elevation.
File won't open. Catch-all for malformed files that no parser will load. The common culprits: corrupt XML (open in a text editor; confirm the first lines include a valid GPX 1.0 or 1.1 declaration), wrong file extension (some apps export as .gpx.txt or .xml — rename to .gpx), or a non-standard GPX 2.x namespace from niche tools (no published 2.0 schema exists; only 1.0 and 1.1 are guaranteed to parse). The viewmygpx viewer returns a useful diagnostic message in each of these cases — try it first to narrow down which one applies.
Try it: parse a GPX file in your browser
Drop a .gpx file onto the viewer below. The parser runs entirely client-side and surfaces structured errors as readable messages, so it doubles as a fast well-formedness check.
Drop your GPX file here
or browse to choose
Parsed locally · never uploaded
Common questions
What is the GPX file format?
GPX (GPS Exchange Format) is an open XML schema for representing GPS data — waypoints, routes, and tracks. It was published by TopoGrafix in 2002 (version 1.0) with a revision in 2004 (version 1.1). Files use the .gpx extension and validate against an XSD schema.
Is GPX an open standard?
Yes. GPX is published openly by TopoGrafix, with the schema available at topografix.com. There is no licensing fee, no required membership, and no patent encumbrance. Any application can read or write GPX without permission.
What's the difference between GPX 1.0 and 1.1?
GPX 1.1 (2004) introduced a formal <extensions> wrapper for vendor-specific data and removed inline speed/course attributes from trkpt — those moved into extensions. The XML namespace also changed from /GPX/1/0 to /GPX/1/1. Most modern software emits 1.1; parsers should still handle 1.0 for older archives.
What's the GPX namespace URI?
For GPX 1.1 it is http://www.topografix.com/GPX/1/1. For GPX 1.0 it is http://www.topografix.com/GPX/1/0. The namespace is declared on the root <gpx> element and is required for the file to be well-formed.
Where do I find the GPX 1.1 schema?
The XSD lives at https://www.topografix.com/GPX/1/1/gpx.xsd. TopoGrafix has hosted the schema continuously since 2004. xsi:schemaLocation in the root element optionally points to it for validators that fetch on demand.
Can I write GPX by hand?
Yes. GPX is plain text XML. A minimal valid file declares the XML version, the GPX root with version and namespace attributes, and at least one waypoint, route, or track with valid lat/lon coordinates. Editors that lint XML will catch the common syntax mistakes.
Are timestamps in GPX always UTC?
By convention, yes. The GPX schema requires ISO 8601 dateTime values, and the practical norm is UTC with a Z suffix (e.g. 2026-04-25T08:00:00Z). Local-offset timestamps are technically valid but break naive sorting across time zones, so well-behaved producers always write UTC.
How do I add custom data to a GPX file?
Use the <extensions> element. Define your own XML namespace, declare it on the root, and place your elements inside <extensions>. Parsers that don't recognize the namespace ignore the contents — that backwards-compatibility is the whole reason extensions exist.
Can a GPX file have multiple tracks?
Yes. The schema allows zero or more <trk> elements at the top level, each with zero or more <trkseg> segments. Multi-day tours and multi-activity recordings often use one track per day or one segment per activity break.
What encoding should a GPX file use?
UTF-8 is the standard. The XML declaration should read <?xml version="1.0" encoding="UTF-8"?>. Latin-1 (ISO-8859-1) files exist in older archives but cause issues whenever names or descriptions include non-ASCII characters.