How to Create a KML File for Google Earth and Maps
A beginner-friendly guide to creating KML points, paths, and polygons, choosing coordinate order, validating the XML, and preparing a file for Google Earth or Google My Maps.
Create a KML file by defining a valid KML document, adding Placemarks with longitude-latitude coordinates, and saving the XML with a .kml extension. For a no-code workflow, use a browser-based KML editor or convert an existing GeoJSON, CSV, or GPX file, then validate and preview the result.
KML Editor
Create and edit supported KML features locally in your browser, then export a KML file.
Choose the Right Way to Create KML
For one or two points, a browser editor is usually fastest. For a table of coordinates or an existing GIS layer, convert GeoJSON, CSV, or GPX to KML. Direct XML editing is useful when you need precise control over styles, folders, or metadata, but every tag must remain well-formed.
Create Points, Lines, and Polygons
A KML Placemark can contain a Point, LineString, or Polygon. Points mark locations, LineStrings represent routes or boundaries, and Polygons define filled areas. Give each feature a meaningful name and description so the layer remains understandable when opened in Google Earth.
Use the Correct Coordinate Order
Write coordinates as longitude,latitude,altitude. Longitude comes first, even though many spreadsheets display latitude first. Keep longitude between −180 and 180 and latitude between −90 and 90. For polygons, repeat the first coordinate at the end to close the ring.
Swapping latitude and longitude can create a valid-looking file that appears on the wrong continent.
Validate and Preview Before Sharing
Run the new file through a KML Validator to catch malformed XML, missing namespaces, and invalid coordinates. Then open it in the KML Viewer and Google Earth. Check the feature names, geometry, styling, and camera location before sending the file to someone else.
Explore Related Spatial Tools
People Also Ask About How to Create a KML File for Google Earth and Maps
Essential questions answered with verified geodesic formulas, datum standards, and practical mapping advice.
Use a KML editor or converter, add valid points, lines, or polygons, export with a .kml extension, and validate the file.
Geospatial Content Team
Specializing in geodetic algorithms, WGS84 coordinate mathematics, and large-scale spatial mobility studies across North America and Europe.
Senior GIS Analyst
Reviewed against the calculation method and source limitations documented for each tool. Provider-backed results and real-world conditions can vary.
More From the Geospatial Blog
View all guidesHow to Draw a Radius on Google Maps (and Free Map Radius Tools)
A definitive guide on drawing 5-mile, 10-mile, or custom distance circles around addresses on Google Maps, overcoming Web Mercator distortion, and using free dedicated radius tools.
How to Calculate Driving Distance Between Two Points (Road vs Straight-Line)
A comprehensive technical and practical guide to calculating road driving distance versus straight-line geodesic distance between addresses, coordinates, and cities.
How to Find the Elevation of an Address or Location (Above Sea Level)
A complete guide to finding the exact elevation above sea level for any home address or coordinate point using USGS LiDAR, Copernicus 30m DEMs, and GPS sensors.