How to Read a GPX File: A Complete Guide

If you've ever downloaded a cycling route, shared a hiking trail, or exported a run from your GPS watch, you've probably encountered a GPX file. But what actually is one? And what's inside it?

This guide explains everything you need to know about GPX files - from the raw XML inside them to practical tips for opening, editing, and using them in your outdoor adventures.

What Is a GPX File?

GPX stands for GPS Exchange Format. It's an open standard based on XML (a structured text format) that stores geographic data - routes, tracks, and waypoints - in a way that any device or application can understand.

The format was created by TopoGrafix in 2002 and has since become the universal standard for sharing GPS data. Whether you're using a Garmin, Wahoo, or Hammerhead device, Strava, Komoot, or RideWithGPS, they all speak GPX.

This interoperability is the whole point. You can plan a route in one app, export it as GPX, and load it onto a completely different device. No vendor lock-in, no proprietary formats - just a simple text file that describes where to go.

What's Inside a GPX File?

A GPX file is plain text - structured XML that you can open in any text editor. Before diving into the XML, here's the overall structure:

GPX File
 ├── Metadata (name, description, author, bounds)
 ├── Waypoints (standalone named locations)
 ├── Routes → Route Points (sparse navigation instructions)
 └── Tracks → Segments → Track Points (dense breadcrumb trail)
                              ├── lat, lon
                              ├── elevation
                              ├── time
                              └── extensions (HR, cadence, power...)

Every GPX file follows this hierarchy. The three main elements - waypoints, routes, and tracks - can appear in any combination, and a single file can contain multiples of each.

Here's what a typical GPX file looks like in practice:

<?xml version="1.0" encoding="UTF-8"?>
<gpx version="1.1" creator="PitStopper.net"
  xmlns="http://www.topografix.com/GPX/1/1"
  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>Yorkshire Dales Loop</name>
    <desc>A scenic cycling route through Wensleydale and Swaledale</desc>
    <author><name>Andrew</name></author>
    <time>2026-03-09T08:00:00Z</time>
    <bounds minlat="54.3088" minlon="-2.0451"
            maxlat="54.4015" maxlon="-1.9200"/>
  </metadata>

  <wpt lat="54.3270" lon="-1.9712">
    <ele>220</ele>
    <name>Aysgarth Falls Cafe</name>
    <desc>Good coffee and cake stop</desc>
    <sym>Restaurant</sym>
    <type>Food</type>
  </wpt>

  <wpt lat="54.4015" lon="-2.0451">
    <ele>526</ele>
    <name>Buttertubs Pass Summit</name>
    <desc>Highest point on the route</desc>
    <sym>Summit</sym>
    <type>Summit</type>
  </wpt>

  <trk>
    <name>Yorkshire Dales Loop</name>
    <type>cycling</type>
    <trkseg>
      <trkpt lat="54.3088" lon="-1.9350">
        <ele>253.4</ele>
        <time>2026-03-09T08:00:00Z</time>
      </trkpt>
      <trkpt lat="54.3091" lon="-1.9345">
        <ele>254.1</ele>
        <time>2026-03-09T08:00:05Z</time>
      </trkpt>
      <!-- thousands more points... -->
    </trkseg>
  </trk>
</gpx>

Let's break down each section.

The Root Element

The <gpx> tag wraps everything. It has two required attributes: version (always "1.1" for the current spec) and creator (the software or device that generated the file). The xmlns attribute declares the GPX namespace, and the xsi:schemaLocation points to the official XML schema definition so the file can be validated.

All coordinates in GPX use the WGS 84 datum (the same coordinate system used by GPS satellites). Latitude and longitude are expressed in decimal degrees, and elevation is in metres. This is defined by the specification - there's no option to use a different datum or unit.

Metadata

The <metadata> block contains information about the file itself. It supports:

  • name and desc: a title and description for the file
  • author: who created it (can include name, email, and a link)
  • time: when the file was created (ISO 8601 format)
  • bounds: a bounding box defining the geographic extent of the data (minlat, minlon, maxlat, maxlon)
  • keywords: for categorisation
  • copyright: licence information
  • link: a URL for more information

Not all GPX files include metadata - every field is optional. But the <bounds> element is particularly useful because it lets applications quickly determine where the data is located without parsing every coordinate.

Waypoints (<wpt>)

According to the GPX schema, waypoints come first after metadata - before routes and tracks. This matters: GPX is defined by an XML schema (XSD), and elements must appear in the correct order for the file to be technically valid. Many applications are forgiving about ordering, but some strict parsers will reject a file with elements in the wrong sequence.

Waypoints are standalone named locations - pins on a map. Each has lat and lon attributes on the element itself, and can contain a range of child elements:

<wpt lat="54.4015" lon="-2.0451">
  <ele>526</ele>
  <name>Buttertubs Pass Summit</name>
  <cmt>Steep climb from both sides</cmt>
  <desc>Highest point on the route</desc>
  <src>OpenStreetMap</src>
  <link href="https://en.wikipedia.org/wiki/Buttertubs_Pass">
    <text>Wikipedia</text>
  </link>
  <sym>Summit</sym>
  <type>Summit</type>
</wpt>

The most commonly used child elements are:

  • ele: elevation in metres above mean sea level
  • name: the display name shown on GPS devices
  • cmt: a comment (typically not displayed, but stored)
  • desc: a longer description
  • sym: the symbol to show on the device (e.g., "Summit", "Restaurant", "Water Source", "Campground") - device support varies
  • type: a classification for the waypoint
  • link: a hyperlink with optional text

Waypoints also support GPS quality fields like <fix> (fix type: none, 2d, 3d, dgps, pps), <sat> (number of satellites used), and <hdop> / <vdop> / <pdop> (dilution of precision values). These are mostly relevant for recorded waypoints rather than manually created ones.

Waypoints are perfect for marking points of interest: water stops, cafes, viewpoints, or hazards. When you load a GPX with waypoints onto your GPS device, they typically appear as named markers that you can navigate to.

Routes (<rte>)

Routes come next in the schema ordering. A route contains route points (<rtept>) - just the key decision points (junctions, turns), not every point along the way. Your GPS device is expected to calculate the path between them using its own mapping data.

<rte>
  <name>Hawes to Reeth</name>
  <type>cycling</type>
  <rtept lat="54.3270" lon="-1.9712">
    <name>Turn left onto A684</name>
  </rtept>
  <rtept lat="54.3850" lon="-1.9200">
    <name>Right at Askrigg junction</name>
  </rtept>
</rte>

Route points (<rtept>) support the same child elements as waypoints - ele, name, desc, sym, and so on. A route is essentially an ordered list of waypoints that form a path.

Tracks (<trk>)

Tracks come last and are the most common element. A track is a recorded path - a breadcrumb trail of every point your GPS logged. Each track contains one or more track segments (<trkseg>), and each segment contains track points (<trkpt>).

Every track point has lat and lon attributes, plus optional child elements:

  • ele: elevation in metres above mean sea level
  • time: the timestamp when this point was recorded (ISO 8601, e.g., 2026-03-09T08:00:05Z)
  • fix, sat, hdop, vdop, pdop: GPS quality data (fix type, satellite count, dilution of precision)

A typical recorded ride might have thousands of track points - one every few seconds. A planned route might have fewer, with the expectation that your device will calculate the road between them.

Why Multiple Track Segments?

A <trk> can contain multiple <trkseg> elements. A new segment is started when there's a break in the recording - for example, if the GPS lost signal in a tunnel, or if the rider paused and resumed recording. Each segment represents a continuous, unbroken sequence of points. Applications typically draw a line through each segment but leave a gap between segments.

<trk>
  <name>Morning Ride</name>
  <trkseg>
    <!-- Points before the tunnel -->
    <trkpt lat="54.3088" lon="-1.9350"><ele>253</ele></trkpt>
    <trkpt lat="54.3091" lon="-1.9345"><ele>254</ele></trkpt>
  </trkseg>
  <trkseg>
    <!-- Points after the tunnel - new segment due to signal loss -->
    <trkpt lat="54.3120" lon="-1.9280"><ele>260</ele></trkpt>
    <trkpt lat="54.3125" lon="-1.9272"><ele>261</ele></trkpt>
  </trkseg>
</trk>

Extensions - the Non-Standard Extras

GPX 1.1 supports an <extensions> element at multiple levels - on the root <gpx>, on individual track points, waypoints, and more. Extensions allow third-party data to be embedded without breaking the standard format.

This is important to understand: extensions are not part of the GPX specification. They're a mechanism for manufacturers to add their own data. Different devices use different extension schemas, and there's no guarantee that one app can read another's extensions. A Garmin file and a Wahoo file might both contain heart rate data, but structured differently.

The most common extensions you'll encounter are Garmin's TrackPointExtension, which stores heart rate, cadence, temperature, and power data:

<trkpt lat="54.3088" lon="-1.9350">
  <ele>253</ele>
  <time>2026-03-09T08:00:00Z</time>
  <extensions>
    <gpxtpx:TrackPointExtension>
      <gpxtpx:hr>142</gpxtpx:hr>
      <gpxtpx:cad>85</gpxtpx:cad>
      <gpxtpx:atemp>14</gpxtpx:atemp>
    </gpxtpx:TrackPointExtension>
  </extensions>
</trkpt>

This is how devices like Garmin store fitness data within a GPX file while keeping the file compatible with any standard GPX reader. Applications that don't understand the extensions simply ignore them.

Coordinate Precision

You'll notice coordinates like lat="54.3088" - four decimal places. The number of decimal places determines accuracy:

Decimal places Approximate accuracy
4 (54.3088) ~11 metres
5 (54.30880) ~1.1 metres
6 (54.308800) ~0.11 metres
7 (54.3088000) ~0.011 metres

Most GPS devices record 5-6 decimal places, which gives sub-metre precision. More than 6 is rarely useful since consumer GPS accuracy is typically 2-5 metres at best. Planning tools often use fewer decimal places since exact precision isn't needed for a route to follow.

Tracks vs Routes vs Waypoints

This distinction trips people up, and it's often explained poorly - even in official documentation. Tracks and routes are not interchangeable. They represent fundamentally different things.

Element What it is Typical points Use case
Track (<trk>) A complete breadcrumb trail Hundreds to thousands "Follow this exact line"
Route (<rte>) Navigation instructions - key decision points only Tens of points "Navigate via these junctions"
Waypoint (<wpt>) A single named location Individual points "Here's a notable place"

A real-world analogy helps: a route is like Google Maps directions - "turn left at the roundabout, take the A684 for 3 miles, turn right." Your satnav calculates the road between each instruction. A track is like the GPS recording after you've actually ridden - every position your device logged, every second, forming a complete breadcrumb trail. One is instructions; the other is a recording.

Tracks - the full picture

A track is a dense series of points that describes a path precisely. Every recorded GPS fix (typically one per second) becomes a track point. A 4-hour ride might contain 14,000+ points. When you share a track, the receiving device draws an exact line through every point - it doesn't need to calculate anything.

Tracks are hierarchical: a <trk> contains one or more <trkseg> (track segments), each of which contains many <trkpt> (track points). A new segment starts when recording was paused, GPS signal was lost, or the device was turned off and on again.

Routes - just the key points

A route is a sparse set of navigation waypoints - typically just the turns, junctions, and decision points. Your GPS device is expected to calculate its own path between these points using its internal maps. This means the same route file can produce different paths on different devices, depending on their mapping data and routing preferences.

Routes contain far fewer points than tracks (often 20-50 vs thousands), which makes them much smaller files. But they're less predictable - the device might route you differently than you intended.

When to use which

Use tracks in almost all cases - for sharing cycling routes, hiking trails, or any path you want someone to follow precisely. The receiving device displays the exact line. No ambiguity.

Use routes when you specifically want the device to calculate its own path - for example, car navigation where you want it to reroute around traffic, or when you only care about visiting certain waypoints in order.

Use waypoints alongside tracks or routes to mark specific locations - water stops, cafes, viewpoints, hazards, or control points. They appear as named pins on the device.

In practice, the vast majority of GPX files shared online contain tracks, not routes. If you download a GPX from Strava, Komoot, RideWithGPS, or PitStopper, it will almost always be a track.

Data Density and Simplification

A GPX file recorded at one-second intervals for a 6-hour ride contains roughly 21,600 track points. A multi-day event could produce 100,000+. This creates practical issues:

  • File size: Each track point is 100-200 bytes of XML. A 20,000-point file can be 2-4MB. With extensions (HR, cadence, power), this grows further.
  • Processing speed: Some apps and devices struggle with very large files. Older Garmin units may reject files above a certain point count.
  • Display performance: Drawing 50,000 points on a web map is slow.

To manage this, devices and apps often simplify tracks - removing points that don't significantly change the path's shape. The Douglas-Peucker algorithm is the most common method: it identifies "redundant" points on straight sections and removes them while preserving corners and curves. A 20,000-point track might be reduced to 2,000 points with minimal visible difference.

This is worth knowing because the GPX file you download from a planning tool will often have far fewer points than a raw GPS recording. Both represent the same route, but the dense recording captures micro-movements (wobbles, stops at traffic lights) while the simplified version is a clean line. For navigation purposes, the simplified version is usually better. For activity analysis (speed, pacing, stops), you want the original recording.

How to Open a GPX File

"Reading" a GPX file means different things depending on what you're trying to do. Most people just want to view a GPX file - see the route on a map, check the distance, look at the elevation profile. For that, drag it into any mapping app. But sometimes you need to inspect the raw data - check if elevation data exists, see how many track points there are, diagnose why a file looks wrong. For that, you need a text editor.

In a Text Editor

The simplest way to inspect a GPX file is to open it in a text editor (Notepad, VS Code, TextEdit). Since it's just XML, you can read the coordinates, check the metadata, and see how many points it contains. This is useful for debugging problems or understanding what data is included.

In Planning Apps

Most route planning applications can import GPX files:

  • Strava: Upload via the website (not the app) under "Upload Activity"
  • Komoot: Import via "Plan a tour" > "Import GPX file"
  • RideWithGPS: Upload via "Routes" > "Import"
  • Garmin Connect: Upload via the web interface
  • Google Earth: Open directly - it renders the track on the 3D globe

In Web-Based Tools

PitStopper lets you drag and drop a GPX file onto the map. It renders the route, shows the elevation profile, and lets you search for points of interest along the way - water taps, cafes, bike shops, accommodation. You can then export an enhanced GPX with those POIs added as waypoints.

On GPS Devices

To load a GPX onto a GPS device:

  • Garmin: Connect via USB and copy the file to the Garmin/NewFiles/ folder, or sync through Garmin Connect
  • Wahoo: Upload through the Wahoo companion app or sync from a connected service
  • Hammerhead: Sync through the Hammerhead companion app

Most devices will display the track as a line on the map and show waypoints as named markers.

Understanding Elevation Data in GPX Files

The <ele> tag in each track point stores elevation in metres above mean sea level. But this data isn't always reliable.

GPS Altitude vs Barometric Altitude

Your GPS receiver calculates altitude from satellite signals, but this measurement is notoriously inaccurate - errors of 10-30 metres are common, and readings can fluctuate wildly even when you're standing still. This noise creates phantom elevation changes that inflate your total elevation gain.

Devices with barometric altimeters (most cycling computers, some GPS watches) produce much smoother and more accurate altitude data. If your GPX was recorded with a barometric altimeter, the elevation data will be more trustworthy.

DEM Correction

Many apps correct GPS elevation data using Digital Elevation Models (DEMs) - detailed maps of the earth's surface elevation derived from satellite radar. When you upload a GPX to Strava or similar services, they often replace the recorded elevation with DEM-corrected values, giving you a cleaner elevation profile.

PitStopper uses elevation APIs to fetch accurate DEM-based elevation data, giving you a reliable elevation profile even if the original GPX has poor or missing altitude data.

Elevation Gain Calculation

Total elevation gain is surprisingly tricky to calculate. If you simply add up every upward movement between track points, GPS noise will inflate the number significantly. Most tools apply some form of smoothing or dead-band filtering - ignoring small fluctuations below a threshold (typically 2-5 metres) to produce a more realistic figure.

Two people can look at the same GPX file and calculate different elevation gain figures, depending on what smoothing algorithm they use. This is why Strava, Garmin, and your bike computer might all show slightly different numbers for the same ride.

Common GPX Problems and How to Fix Them

Missing Elevation Data

Some GPX files contain only latitude and longitude - no elevation. This happens when the file was generated from a map (drawing a route by clicking) rather than recorded with a GPS device.

Fix: Upload the GPX to a tool that can add elevation data. PitStopper and most route planning apps will fetch elevation from a DEM service automatically.

Too Many Track Points

A day-long recording at one-second intervals can produce 30,000+ track points. This makes the file large and slow to process.

Fix: Use a tool to simplify the track. The Douglas-Peucker algorithm removes redundant points while preserving the route's shape. Most GPX editors offer a "simplify" or "reduce points" option.

Too Few Track Points (Straight Lines)

Some exported files have very few points, causing the displayed path to cut straight across bends, through buildings, or over rivers. This usually means the file contains a route (<rte>) rather than a track (<trk>), or a track was aggressively simplified. The creating device expected the receiving device to snap the path to roads using its own maps - but not all devices do this.

Fix: Re-route the GPX through a planning tool that adds intermediate points along the actual road network.

Corrupt or Malformed XML

If a GPX file won't open, it might have invalid XML - missing closing tags, encoding errors, or truncated data (perhaps the device ran out of battery mid-recording).

Fix: Open the file in a text editor and look for obvious issues. Common problems include:

  • Missing closing </gpx> tag at the end
  • Invalid characters in names or descriptions
  • Truncated data (file ends abruptly)

For truncated files, adding the missing closing tags (</trkseg></trk></gpx>) at the end will often recover the data.

Large File Sizes

GPX files are text-based and can be verbose. A long ride might produce a 5-10MB file.

Fix: Compress the file (GPX files compress very well as ZIP) or reduce the number of track points. Removing timestamp data and unnecessary extensions can also reduce file size.

Creating Your Own GPX Files

Recording with a GPS Device

The most common way to create a GPX file is to record an activity. Start recording on your GPS device, do your ride or hike, then export the file. Most devices save in their own format (Garmin uses FIT, for example) but offer GPX export through their companion apps.

Drawing Routes in Planning Tools

Route planners like Komoot, RideWithGPS, and PitStopper let you draw a route on a map. Click points along your intended path, and the tool generates a GPX file with the route snapped to roads or trails.

Converting from Other Formats

Other common GPS formats include:

  • FIT (Garmin's native format): Use Garmin Connect or a conversion tool
  • TCX (Training Center XML): Similar to GPX but includes heart rate and power data
  • KML/KMZ (Google Earth): Use GPS Visualizer or similar tools to convert

PitStopper supports both GPX and FIT file formats directly.

GPX and PitStopper

PitStopper is built around the GPX format. Upload any GPX file and the tool will:

  • Display the route on an interactive map with distance markers
  • Show the elevation profile with accurate DEM-corrected altitude data
  • Search for POIs along the route - water sources, cafes, bike shops, accommodation, and 60+ other categories
  • Add waypoints for discovered POIs, so when you export the file your GPS device will alert you to nearby stops
  • Export an enhanced GPX containing both your original route and the new waypoints

The round-trip workflow - import GPX, enhance with POIs, export GPX - means your navigation device gets the benefit of PitStopper's POI database without needing an internet connection on the ride.

Summary

GPX files are straightforward once you understand the structure. They're just XML text files containing coordinates, and the three main elements - tracks, routes, and waypoints - cover everything you need for outdoor navigation.

The format's simplicity is its greatest strength. A GPX file created on one platform works on any other. No accounts, no subscriptions, no compatibility issues - just a universal way to describe where you've been or where you want to go.

Next time you download a GPX file, try opening it in a text editor before loading it onto your device. Understanding what's inside will help you troubleshoot problems, combine routes, and get more out of your navigation tools.