devkult_
tools30converters34
home/mime/.kml

.kml MIME type

KMLtext & code

application/vnd.google-earth.kml+xml

Keyhole Markup Language — placemarks, paths and overlays for Google Earth and Google Maps.

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

Good to know

  • Zipped KML uses .kmz and application/vnd.google-earth.kmz: a ZIP archive with a main .kml file (conventionally doc.kml) and its images.
  • KML writes coordinates as longitude,latitude[,altitude] — the same order as GeoJSON.

Serve .kml files with the right type

The response header to send:

Content-Type: application/vnd.google-earth.kml+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/vnd.google-earth.kml+xml kml;
Apache (.htaccess or server config)
AddType application/vnd.google-earth.kml+xml .kml
Express
res.set("Content-Type", "application/vnd.google-earth.kml+xml; charset=utf-8");
Python
import mimetypes

mimetypes.add_type("application/vnd.google-earth.kml+xml", ".kml")
HTML file input
<input type="file" accept=".kml,application/vnd.google-earth.kml+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.kml | grep -i '^content-type:'
file --mime-type file.kml

Frequently asked questions

What is the MIME type for .kml files?

application/vnd.google-earth.kml+xml.

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

Content-Type: application/vnd.google-earth.kml+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