Complete Guide to KML Files: Everything You Need to Know
What is a KML file? Comprehensive guide to Keyhole Markup Language, how to open, edit, and convert KML files for Google Earth and GPS.
What is a KML file? KML (Keyhole Markup Language) is an XML-based file format used to display geographic data in Earth browsers such as Google Earth, Google Maps, and other mapping software. It stores locations, routes, and overlays with rich visualization capabilities.
Created originally for Keyhole Earth Viewer (which became Google Earth), KML is now an international standard maintained by the Open Geospatial Consortium (OGC).
What KML Files Contain
Unlike basic GPS formats, KML focuses on visualization. A single file can contain:
Placemarks
Points of interest marked with icons and labels:
- Exact coordinates (latitude/longitude/altitude)
- Custom icons and styles
- Descriptions (HTML supported)
- View angles (Camera views)
Paths and Polygons
Lines and shapes drawn on the map:
- Routes (LineStrings) with color and width styling
- Areas (Polygons) with fill colors
- 3D extrusions (buildings, walls)
Overlays
Visual layers added to the map:
- Ground overlays (images draped over terrain)
- Screen overlays (logos, legends)
- Photo overlays
KML File Structure
KML is text-based XML, making it human-readable. Here's a simple example:
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2">
<Placemark>
<name>Simple Placemark</name>
<description>Attached to the ground.</description>
<Point>
<coordinates>-122.0822035425683,37.42228990140251,0</coordinates>
</Point>
</Placemark>
</kml>
KML vs Other Formats
How does KML compare to other common GPS formats?
| Feature | KML | GPX | KMZ | FIT |
|---|---|---|---|---|
| Primary Use | Google Earth | GPS Devices | Google Earth | Garmin Devices |
| Format | XML (Text) | XML (Text) | Zipped KML | Binary |
| Styling | ✅ Rich | ❌ Basic | ✅ Rich | ❌ None |
| File Size | Medium | Medium | Small | Small |
| Navigation | ❌ Limited | ✅ Best | ❌ Limited | ✅ Good |
For a deeper dive, see our KML vs GPX Format Comparison.
How to Create KML Files
Google Earth Pro
- Right-click "My Places"
- Add > Placemark / Path / Polygon
- Right-click the item and select "Save Place As..."
- Choose "Kml" format
Google My Maps
- Create a new map and add points
- Click the three dots menu
- Select "Export to KML/KMZ"
From Other Formats
Use our converters to turn your GPS data into KML:
- GPX to KML - For standard GPS tracks
- FIT to KML - For Garmin activities
How to View KML Files
Desktop Applications
- Google Earth Pro: The gold standard for KML viewing
- ArcGIS / QGIS: Professional GIS software
- Marble: Open-source virtual globe
Web Viewers
- Google Earth Web: View directly in Chrome
- Google Maps: Can import simple KML files
- KML Viewer Online: Various free web tools
How to Convert KML Files
To use KML data on GPS devices, you usually need to convert it to GPX.
Tool: KML to GPX Converter
This is essential for:
- Hiking with a Garmin handheld
- Cycling with a Wahoo/Hammerhead
- Running with a Coros/Suunto watch
See our guide: How to Convert KML to GPX
Common KML Issues
File Too Large
KML files are text and can get huge. Solution: Save as KMZ (compressed KML) or simplify the geometry.
Not Showing on GPS
Most GPS units don't read KML. Solution: Convert to GPX first.
Missing Textures/Icons
If a KML links to local images on your computer, they won't show for others. Solution: Use KMZ format which bundles images inside the file.