Keyhole Markup Language (.kml)

OGC Standard

Keyhole Markup Language (KML) is the open XML standard for expressing geographic annotation and visualization, originally developed for Keyhole Earth Viewer (Google Earth) and standardized by the Open Geospatial Consortium (OGC).

Convert GEOJSON to KML

Free in-browser GEOJSON to KML converter. Convert files instantly on your device.

Inspect & Metadata

Operating systems and file analyzers identify KML files by inspecting the leading binary byte sequence:

Select or drop files here

100% private in-browser conversion - files never leave your device

or paste Ctrl+V
Zero-Network-Transmission Privacy Guarantee: 0 bytes uploaded to external servers. All processing occurred locally in your browser sandbox.

Byte-Level Header Signature (Magic Bytes)

Operating systems and file analyzers identify KML files by inspecting the leading binary byte sequence:

HEX SIGNATURE (OFFSET 0):

3C 6B 6D 6C

ASCII REPRESENTATION: <kml

Standardization: OGC KML 2.3 Standard

Technical Specifications

Container ArchitectureXML-based geographic visualization grammar defining Placemarks, GroundOverlays, 3D Models, and Camera perspectives
CompressionUncompressed XML text (compressed with ZIP as .kmz files)
Byte EndiannessUTF-8 / Unicode text stream
Color SpacesAABBGGRR hexadecimal color strings
Channels & StructurePlacemarks, paths, polygons, 3D building models, photo overlays, and tour camera paths
Max DimensionsWGS 84 coordinates: Longitude, Latitude, Altitude (in meters above sea level)
TransparencyAlpha transparency supported in AABBGGRR color strings and PNG overlays
Streaming & ProgressiveNetworkLinks support dynamic streaming updates from remote geospatial servers

Technical Comparison Matrix: KML vs Competitors

Technical AttributeKML (Current)GEOJSONGPXKMZ
3D Camera & TouringFull camera tilt, heading, & fly-through toursNone (flat geometry properties)Altitude elevation trackingFull camera tilt & fly-through tours
Packaging FormatPlaintext XML documentPlaintext JSON documentPlaintext XML documentZIP archive containing doc.kml
Color FormatAABBGGRR (Alpha-Blue-Green-Red)CSS / Hex standardNoneAABBGGRR
Primary DestinationGoogle Earth & 3D GISWeb maps (Mapbox, Leaflet)Garmin & GPS fitness trackingGoogle Earth standalone archive

Common Corruption Modes & Hex Recovery Guide

Google Earth error: 'Parse error at line X: mismatched tag'.

Root Cause: Unclosed XML tag or unescaped ampersand in balloon description HTML.

Recovery: Repair XML syntax and wrap description in <![CDATA[...]]> using File2File KML Repair.

Security Analysis & Parser Attack Vectors

KML files support NetworkLinks and HTML description balloons that can trigger XXE, SSRF, or Cross-Site Scripting (XSS).

Known Attack Vectors

  • Server-Side Request Forgery (SSRF) via malicious <NetworkLink> tags polling internal intranet endpoints.
  • XSS injection via unsanitized HTML inside <description> tags executed in desktop or web Earth balloons.
  • XML External Entity (XXE) injection during automated KML processing.

Defensive Best Practices: Disable external network fetching and sanitize balloon HTML content with DOMPurify.

Historical Origins & Milestones

2008Open Geospatial Consortium (OGC) adopts KML 2.2 as an official International Geospatial Standard.
2005Google acquires Keyhole Inc., rebranding Keyhole Earth Viewer as Google Earth and democratizing KML globally.
2001Keyhole Inc. creates KML to annotate 3D satellite imagery.

Key Advantages & Pros

  • Rich 3D Earth visualization: defines not just points, but 3D camera angles, heading, tilt, altitude, and fly-through tours.
  • Supported natively by Google Earth, Google Maps, ArcGIS, and all professional desktop GIS software.
  • Supports NetworkLinks, allowing Google Earth to dynamically stream live weather, flight tracking, and seismic updates.

Technical Limitations & Cons

  • Verbose XML syntax results in larger file sizes than compact formats like GeoJSON.
  • Colors use unconventional AABBGGRR hexadecimal order (Alpha-Blue-Green-Red) rather than standard RGBA.
  • Complex 3D features (Tours, Models) are rarely supported on lightweight web mapping platforms.

Interesting Technical Trivia

  • Keyhole Inc. was named after the historic KH (Keyhole) reconnaissance spy satellites launched by the United States during the Cold War.
  • In KML, color values are written backwards as AABBGGRR: the first two characters are Alpha, then Blue, then Green, then Red.
  • A '.kmz' file is literally just a standard .zip archive containing a single 'doc.kml' file and any embedded images or 3D models.

Frequently Asked Technical Questions

What is the difference between KML and KMZ?

KML is a plain text XML file. KMZ is a compressed ZIP file that contains a KML file alongside any custom map icons, textures, or 3D overlay images.

How can I convert KML to GeoJSON?

You can convert Google Earth KML files into clean GeoJSON for web mapping in one click using File2File.app directly in your browser.

Can I open a KML file in Google Maps?

Yes! In Google Maps, go to 'Saved' -> 'Maps' -> 'Create Map' (Google My Maps) and click 'Import' to upload your KML file.