Trail Notes

How to Create a GPX File

Five ways to make one, from clicking a map to typing it yourself. What you start with decides which.

Basics Reading time: 8 minutes Updated By the GPX Analyzer project

How Do You Create a GPX File?

A GPX file is a plain text file that lists positions, so there are several ways to make one. The quickest with nothing installed is the free GPX Waypoint Editor: choose Start with an empty map, click the map once for each point or type its coordinates, name the points, and click Download GPX. If the positions are already in a spreadsheet or a text file, the CSV to GPX Converter turns the list into a file of waypoints or a track in one step. You can also draw a route in a planning app and export it, record one with a phone or a GPS unit, or type the file by hand in a text editor. Which to use depends on what you start with and on whether you need separate points or a line to follow.

First Decide What the File Should Hold

A single line of footprints crossing smooth, untouched desert sand toward distant mountains in low golden light

A GPX file can hold three kinds of thing, and a device treats each differently. Decide which you want before you start, because it settles the method.

In the fileWhat it isMake it whenSimplest way
WaypointsSeparate named points: a trailhead, a spring, a fuel stopYou want places marked on the map, in no particular orderClick them on a map, or convert a list
A routeA short ordered list of points to travel through, which the device joins upYou want the device to guide you from point to pointDraw it in the Route Planner, or turn a track into a route
A trackA long ordered line of points: the exact pathYou want a line on the screen to follow, or a record of where you wentRecord it, or convert an ordered list

One file can hold all three. GPX File Basics goes into the differences, and GPX Waypoints, POIs and Routes covers building a route with its points of interest in one file.

Method 1: Click the Points on a Map

Best for a handful of places you can find on a map, or have coordinates for.

  1. Open the GPX Waypoint Editor and choose Start with an empty map.
  2. Add the points. Choose Add Waypoint and click the map once for each, or type or paste a latitude and longitude and choose Add at Coordinates. Decimal degrees, degrees minutes seconds, and degrees decimal minutes are all read.
  3. Name each one, and give it a symbol, a description, or an elevation if you want them.
  4. Click Download GPX. The file is saved as waypoints.gpx.

Three points made that way produce this file, which is all a GPX waypoint file needs to be:

<?xml version="1.0" encoding="UTF-8"?>
<gpx version="1.1" creator="GPXAnalyzer.com - GPX Waypoint Editor" xmlns="http://www.topografix.com/GPX/1/1">
  <wpt lat="34.05" lon="-116.15">
    <name>Trailhead</name>
    <sym>Waypoint</sym>
  </wpt>
  <wpt lat="34.075" lon="-116.13">
    <name>Spring</name>
    <sym>Waypoint</sym>
  </wpt>
  <wpt lat="34.11" lon="-116.09">
    <name>Camp</name>
    <sym>Waypoint</sym>
  </wpt>
</gpx>

To join the points into a line, load that file into Waypoints to Track. It connects the waypoints in the order they are in the file, by name, or by time, and saves them as one track. To make that a route for a device that navigates point to point, pass the track through GPX Track to Route.

Method 2: Convert a List of Coordinates

Best when the positions already exist as numbers: a spreadsheet, a table copied from a report, a text file from a data logger.

The list needs one position per row, with latitude and longitude in decimal degrees. A header row helps but is not required:

name,latitude,longitude,elevation
Trailhead,34.0500,-116.1500,900
Spring,34.0750,-116.1300,1040
Camp,34.1100,-116.0900,1185
  1. Save it as .csv or .txt. From Excel or Google Sheets, use Save As or Download and choose CSV. Commas, semicolons, and tabs are all recognized as separators.
  2. Load it into the CSV to GPX Converter. It finds the latitude, longitude, elevation, time, and name columns by itself; correct any it gets wrong.
  3. Choose Track or Waypoints. Waypoints keeps each row as a separate named point. Track joins the rows, in order, into one line.
  4. Click Convert to GPX. The four lines above become a file of three waypoints with their names and elevations, or a track of three points. Rows whose coordinates cannot be read are skipped and counted.

If the list is not in decimal degrees, convert it first. The batch converter on the Coordinate Converter page reads UTM, MGRS, USNG, degrees minutes seconds, and several national grids, one position per line, and can save the result directly as a GPX waypoint file. How to Batch Convert a List of Coordinates walks through it, and How to Convert CSV to GPX covers column mapping in detail.

Method 3: Draw It in a Planner and Export

Best for a route that follows roads or trails, where you want the line to bend with the path and not cut straight between your clicks.

  • On this site. The GPX Route Planner lets you click a route out on a map, drag the points until it is right, and download it as a route, a track, or both. Its legs are straight lines, so to follow a trail you click along it; nothing is sent to a routing service.
  • Planners that follow the path for you. Sites and apps such as CalTopo, RideWithGPS, Komoot, and Strava's route builder snap the line to roads and trails as you click, and export it as GPX. Exporting GPX from Strava, Komoot, and AllTrails shows where each one keeps the export.
  • Google Earth and Google My Maps. Both save what you draw as KML, not GPX. In Google Earth, right-click the item, choose Save Place As, and pick .kml. Then run the file through the KML to GPX Converter: points become waypoints and paths become tracks. If you are given a .kmz, it is a zip archive; rename it to .zip, extract it, and use the doc.kml inside. How to Convert KML to GPX has the detail.

A planner's export can be a track with thousands of points. If your device wants a route, or has a point limit, GPX Track to Route and the GPX Track Simplifier cut it down.

Method 4: Record It

Best when the file should show where you really went. A phone app or a GPS unit that records your trip is writing a track as you move, with a time and usually an elevation on every point. Stop the recording, then export or share it as GPX. The export guide covers the common platforms, and Using GPX Files on Your Phone covers recording and following tracks without a signal.

A recording usually needs tidying before it is worth keeping: the drive to the trailhead, the hour parked at lunch. The GPX Editor trims and splits it.

Method 5: Write It by Hand

A GPX file is text, so any plain text editor can make one. This is a complete, valid file with one waypoint, one route, and one track:

<?xml version="1.0" encoding="UTF-8"?>
<gpx version="1.1" creator="Written by hand" xmlns="http://www.topografix.com/GPX/1/1">
  <wpt lat="34.0500" lon="-116.1500">
    <name>Trailhead</name>
  </wpt>
  <rte>
    <name>Trailhead to Camp</name>
    <rtept lat="34.0500" lon="-116.1500"><name>Trailhead</name></rtept>
    <rtept lat="34.0750" lon="-116.1300"><name>Spring</name></rtept>
    <rtept lat="34.1100" lon="-116.0900"><name>Camp</name></rtept>
  </rte>
  <trk>
    <name>Trailhead to Camp</name>
    <trkseg>
      <trkpt lat="34.0500" lon="-116.1500"></trkpt>
      <trkpt lat="34.0750" lon="-116.1300"></trkpt>
      <trkpt lat="34.1100" lon="-116.0900"></trkpt>
    </trkseg>
  </trk>
</gpx>

Save it with the extension .gpx, as plain text in UTF-8. The rules that matter:

  • The opening <gpx> tag carries three things: version="1.1", a creator of your choosing, and the xmlns address exactly as shown. The file ends with </gpx>.
  • Every point has lat and lon, in decimal degrees on the WGS 84 datum, with a decimal point. South and west are negative. Latitude runs from −90 to 90 and longitude from −180 to 180.
  • Order matters. Waypoints come first, then routes, then tracks. Inside a point, elevation and time come before the name.
  • Track points sit inside a segment. A <trk> holds one or more <trkseg>, and the points go in those. Route points sit directly inside <rte>.
  • Every tag that opens must close, and & in a name has to be written &amp;.

Then check it. Loaded into the GPX Validator, the file above reports no errors and no warnings. The usual slips each have a recognizable result: latitude and longitude the wrong way round gives Invalid latitude value; a decimal comma does the same; an unclosed tag gives Invalid XML format with the line number; a missing xmlns gives a warning. How to Fix a Corrupted GPX File explains each message.

Check the File Before You Rely on It

  • Validate it. The GPX Validator takes a few seconds and catches the errors that make a device refuse a file.
  • Look at it on a map. Open it in the GPX Analyzer. A point in the sea or on another continent is almost always a missing minus sign or a swapped latitude and longitude. The example above should show a line about 8.7 km (5.4 miles) long in the southern California desert.
  • Match it to the device. Some units navigate routes and only display tracks; some limit the number of points in either. If a file loads but does nothing useful, it is usually the wrong kind for the device, not a broken file.
  • Remember what it lacks. A file made from a list or by clicking has no times, and no elevation unless you supplied it. That is fine for navigating. A site that expects a recorded activity may not accept it.

Frequently Asked Questions

What is the easiest way to make a GPX file?

For a few points, click them on a map in the Waypoint Editor and download the file. For a list you already have, convert it with CSV to GPX. Neither needs an account or an install.

Can I create a GPX file in Excel?

Not directly, since Excel cannot save GPX. Put the names, latitudes, and longitudes in columns, save the sheet as CSV, and convert that file. A header row naming the columns lets the converter map them without help.

How do I turn a text file into a GPX file?

If the text file has one position per line, load it into CSV to GPX, which accepts .txt as well as .csv. If the positions are written as UTM, MGRS, or degrees and minutes, use the batch converter on the Coordinate Converter page and download its GPX.

Can I create a GPX file from Google Maps?

Not in one step. Google's own tools save KML: draw the route in Google My Maps or Google Earth, export it as KML, and convert it with the KML to GPX Converter.

Do I need elevation and timestamps?

No. Only latitude and longitude are required. Elevation is worth including if you have it, because it lets an app draw a profile and total the climb. Times matter only for a record of a trip.

Should I make a route or a track?

A track if you want an exact line to follow on the screen; a route if you want the device to guide you between a few points. If you are not sure what your device does with each, make a track first: nearly everything can display one, and GPX Track to Route converts it later.

Can I make a GPX file on my phone?

Yes. The tools on this site run in a phone's browser, and the file is saved to the phone. Recording a trip with a navigation app and exporting it is the other way.

Is the file I create uploaded anywhere?

Not by these tools. The Waypoint Editor, the converters, and the Validator all work inside your browser, and the file is never sent to a server.

Related Tools and Guides