iPhone location journals

Convert CSV to GPX, or GPX to CSV, in your browser

Convert a CSV of coordinates to a GPX file, or a GPX file to CSV, in your browser. Nothing is uploaded.

Add a CSV or GPX file. It stays on this device.

Convert a CSV of coordinates to a GPX file, or a GPX file to CSV, in your browser. Nothing is uploaded. Add a .csv or .txt file, or paste the rows, to get a GPX file. Add a .gpx file to get a CSV. No account and no analytics. Files are read with your browser’s File API and never leave the page.

What your CSV needs

One row per point, a header row, and two columns that hold decimal degrees: latitude from −90 to 90 and longitude from −180 to 180. Everything else is optional. Headers are matched without regard to case; the first name in each list that your file has is used, and you can pick another column in the dropdowns.

FieldHeader names recognisedWritten to GPX as
Latitude (required)lat, latitude, ylat attribute
Longitude (required)lon, lng, long, longitude, xlon attribute
Timetime, timestamp, time_utc, date, datetime<time>, in UTC
Elevationele, elevation, elevation_m, alt, altitude<ele>, metres
Namename, title, label<name>, XML-escaped
Group or segmentgroup, segment, trackA new <trkseg> when the value changes

Separators can be commas, semicolons or tabs. In a file that uses semicolons or tabs, a comma is read as a decimal mark, so 52,5 means 52.5. A file with no header row is read as latitude, then longitude. Quoted fields follow RFC 4180. Row numbers in the skipped-row list count the header as row 1.

Worked example: synthetic data

This is synthetic, invented data, not anyone’s trip. synthetic-format-trip.csv has five rows in the GPX viewer’s CSV layout. The first point is latitude 0 and longitude 10, so a swapped pair would show up at once as latitude 10, longitude 0.

kind,group,point,latitude,longitude,time_utc,elevation_m,name,original_time
"track",1,1,0,10,"2000-01-01T12:00:00.000Z",,"","2000-01-01T12:00:00Z"
"track",1,2,0.001,10.001,"2000-01-01T12:01:00.000Z",,"","2000-01-01T12:01:00Z"
"track",1,3,0.002,10.002,"2000-01-01T12:02:00.000Z",,"","2000-01-01T12:02:00Z"
"track",2,1,0.003,10.003,"2000-01-01T12:13:00.000Z",,"","2000-01-01T12:13:00Z"
"track",2,2,0.004,10.004,"2000-01-01T12:14:00.000Z",,"","2000-01-01T12:14:00Z"

Click Try a synthetic example and the tool detects latitude, longitude, time_utc and group, and writes 5 points in 1 track with 2 segments, 0 rows skipped, from 2000-01-01T12:00:00Z to 2000-01-01T12:14:00Z. Segment 1 has 3 points and segment 2 has 2, because the group value changes from 1 to 2 after the third row. The file name here is synthetic-format-trip; the output is:

<?xml version="1.0" encoding="UTF-8"?>
<gpx version="1.1" creator="Whereday CSV to GPX (whereday.com/tools/csv-to-gpx/)" xmlns="http://www.topografix.com/GPX/1/1">
  <metadata><name>synthetic-format-trip</name></metadata>
  <trk>
    <name>synthetic-format-trip</name>
    <trkseg>
      <trkpt lat="0" lon="10"><time>2000-01-01T12:00:00Z</time></trkpt>
      <trkpt lat="0.001" lon="10.001"><time>2000-01-01T12:01:00Z</time></trkpt>
      <trkpt lat="0.002" lon="10.002"><time>2000-01-01T12:02:00Z</time></trkpt>
    </trkseg>
    <trkseg>
      <trkpt lat="0.003" lon="10.003"><time>2000-01-01T12:13:00Z</time></trkpt>
      <trkpt lat="0.004" lon="10.004"><time>2000-01-01T12:14:00Z</time></trkpt>
    </trkseg>
  </trk>
</gpx>

The same points are in synthetic-format-trip.gpx. The site’s tests convert the sample, check the result against the official GPX 1.1 schema, and compare it point by point with that GPX.

A smaller file works too. A CSV with only lat,lon columns becomes waypoints named Point 1, Point 2 and so on. Add a time column and the default becomes a track.

Track or waypoints?

Choose Track when the rows are one journey in order, such as a GPS logger or phone recording. The points are joined into a line, and the times say when each was visited. Choose Waypoints when the rows are places, such as a list of addresses, campsites or photo locations. They are drawn as separate pins, with no line between them and no order implied.

GPX has a third kind, the route, which is a planned path. This tool writes a route only when it reads a CSV that was exported from a GPX file and has a kind column marking rows as route. The GPX file guide explains all three. The GPX 1.1 documentation defines them: a track is an ordered list of points describing a path, divided into segments, and a waypoint is a point of interest. How a particular app draws or lists each one is up to that app, so open the result in the GPX viewer to check it, then try your destination app with a small file first.

Segments. If your rows come from several recordings, add a group column (group, segment or track). A new segment starts wherever its value changes from one row to the next, so the line does not run from the end of one recording to the start of the next. Values do not need to be numbers, and a value that comes back later starts another segment. Without a group column, all rows form one segment.

Time zones: why a bare time is a problem

GPX stores times in UTC; the GPX 1.1 schema defines them as a date and time with a Z or offset. A CSV from a spreadsheet often has a time such as 2000-01-01 12:00:00 with no zone. That could be UTC, the logger’s local time or the time zone of your computer, and the file does not say.

The tool does not guess a time zone from the coordinates or from your browser, and it does not shift times for daylight saving.

GPX to CSV

Add a .gpx file in the box above, or press Try a synthetic GPX (GPX to CSV). The tool reads GPX 1.0 and 1.1 with the same code as the GPX viewer and downloads the same CSV. The columns are:

Names and times that start with =, +, - or @ get a leading apostrophe so that a spreadsheet shows them as text rather than running them as a formula. When you convert that CSV back to GPX, a leading apostrophe in front of one of those characters is removed. Points with unusable coordinates are left out. In Excel, open the CSV through Data → From Text/CSV if you want to see the raw text of the time columns before the program reformats them. Microsoft’s text and CSV import guide describes it.

Converting GPX to CSV and back keeps the points, their order and the segment boundaries. The test suite checks this with a file that has a waypoint, a route and several track segments. It does not keep anything else in the GPX, such as extensions.

Limits

The output is checked against the official GPX 1.1 schema in the site’s tests. That shows the file is well-formed GPX. It does not show that your coordinates are right, so check the plot.

Open the GPX next

Your files stay in this page

Reading, converting, the plot and the download all happen in your browser. The plot is drawn locally with no map tiles. This page blocks network connections and does not load the website’s analytics, and it stores nothing in your browser. The web server sees an ordinary request for the page and its scripts, not your file, its name or the result.

Questions

Can Excel save a GPX file?

No. Excel has no GPX option. Save the sheet as CSV (File → Save As → CSV), then convert the CSV here.

Does this upload my file?

No. The file is read and converted in your browser. This page blocks network connections, so it cannot send the file anywhere.

Why are some rows skipped?

A row is skipped when its latitude or longitude is empty, is not a decimal number, or is out of range (latitude beyond ±90, longitude beyond ±180). The summary lists how many rows were skipped for each reason and the first row numbers, counting the header as row 1. A common cause is degrees-minutes-seconds text, or latitude and longitude in the wrong columns.

Can I convert GPX to Excel?

Convert it to CSV here, then open the CSV in Excel or any spreadsheet program. Use Data → From Text/CSV if you want control over how the columns are read.

Want a GPS log you don’t have to build in a spreadsheet?

Whereday records your visits and routes on your iPhone and exports GPX, CSV and GeoJSON.

Download free for iPhone