devkult_
tools30converters34
home/mime/.gpx

.gpx MIME type

GPX tracktext & code

application/gpx+xml

GPS tracks, routes and waypoints exported from GPS devices, fitness apps and mapping tools.

MIME typeapplication/gpx+xml
Extensions.gpx
Content-Typeapplication/gpx+xml; charset=utf-8
Compress in transit?Yes — enable gzip or Brotli

Good to know

  • application/gpx+xml isn't registered with IANA, but it's what apps use and what Apache's stock config maps .gpx to.
  • GPX stores latitude and longitude as named attributes (<trkpt lat="…" lon="…">), so unlike GeoJSON there's no ordering trap.

Serve .gpx files with the right type

The response header to send:

Content-Type: application/gpx+xml; charset=utf-8

Most servers pick the type from the file extension. If yours sends the wrong one, map it explicitly:

nginx (inside the types block in mime.types)
application/gpx+xml gpx;
Apache (.htaccess or server config)
AddType application/gpx+xml .gpx
Express
res.set("Content-Type", "application/gpx+xml; charset=utf-8");
Python
import mimetypes

mimetypes.add_type("application/gpx+xml", ".gpx")
HTML file input
<input type="file" accept=".gpx,application/gpx+xml">

Check it

See what a server sends for a file, and what type a local file really is by its contents:

curl -sI https://example.com/file.gpx | grep -i '^content-type:'
file --mime-type file.gpx

Frequently asked questions

What is the MIME type for .gpx files?

application/gpx+xml.

What Content-Type header should a .gpx file be served with?

Content-Type: application/gpx+xml; charset=utf-8. As a text format, include the charset so browsers don't guess the encoding. It compresses well, so let the server apply gzip or Brotli.

Related types

Headers that go with it: Content-Type · Content-Disposition · X-Content-Type-Options