Converter Tools
Google Polyline Encoder and Decoder
Encode lat/lng points to a Google encoded polyline, or decode any polyline back to coordinates with a live SVG preview, length, and GeoJSON export.
Encoded polyline
cvwwFzeqbM~W{EnZgEr]~Wb[zO
5 points encoded, 26 characters
Decoded coordinates
38.500000, -120.200000 40.700000, -120.950000 43.252000, -126.453000
3 points decoded
Path preview
Decoded points drawn to scale on a normalized grid. North is up. Bounding box 38.5000, -126.4530 to 43.2520, -120.2000.
StartEnd
Export formats
Drop these into a spreadsheet, the Google Maps JavaScript API, Leaflet, Mapbox GL JS, or any GeoJSON-aware tool.
lat,lng per line
Spreadsheet-friendly. Use with Sheets, Excel, or paste into Google Maps.
38.500000, -120.200000 40.700000, -120.950000 43.252000, -126.453000
GeoJSON [lng, lat] array
Coordinate order used by GeoJSON, Mapbox, and Leaflet's GeoJSON layer.
[[-120.2,38.5],[-120.95,40.7],[-126.453,43.252]]
GeoJSON Feature (LineString)
Drop into geojson.io or Mapbox Studio.
{
"type": "Feature",
"properties": {},
"geometry": {
"type": "LineString",
"coordinates": [
[
-120.2,
38.5
],
[
-120.95,
40.7
],
[
-126.453,
43.252
]
]
}
}How to use
- Pick Encode points to polyline to turn a list of coordinates into a polyline, or Decode polyline to points to expand a polyline back to lat/lng pairs.
- Choose the precision to match the engine you are working with: 5 (Google default), 6 (Mapbox Directions v5), or 4 or 7 for other tools.
- In encode mode, paste one coordinate pair per line. Toggle Longitude first if you are pasting GeoJSON-ordered arrays.
- In decode mode, paste the encoded polyline string. The decoded list, an SVG path preview, the bounding box, and the path length appear immediately.
- Use the export panel to copy the result as lat,lng lines, a GeoJSON coordinate array, or a complete GeoJSON LineString Feature.
About this tool
Google Polyline Encoder and Decoder converts between an ordered list of latitude and longitude points and the Google Encoded Polyline Algorithm Format, the compact ASCII string that Google Directions, Mapbox Directions, OSRM, GraphHopper, Valhalla, Strava, and dozens of other routing engines and fitness platforms use to ship a route in a single field. The algorithm scales each coordinate by 10^precision (5 decimal places by default, the same as Google), takes the delta from the previous point, packs the sign bit into the low position, splits the value into 5-bit chunks, ORs each non-final chunk with a continuation marker, and shifts each chunk into printable ASCII by adding 63. Decode runs the same process in reverse and undoes the sign-shift to recover the signed delta. This tool implements the spec exactly and supports precision 4 through 7 so the same UI works for Google's default 5, Mapbox v5's precision 6, and any other engine that uses a non-default precision. The encode side accepts coordinates in many common shapes: comma-separated, space-separated, with or without surrounding brackets, with or without lat= and lng= labels, and optionally with longitude listed first so a GeoJSON ordered coordinate array pastes directly. The decode side flags malformed characters, truncated chunks, and missing longitude bytes with a clear error rather than silently returning a wrong route. Both sides ship the same outputs: a lat,lng per line list ready for a spreadsheet, a GeoJSON [lng, lat] coordinate array ready for Mapbox or Leaflet, and a full GeoJSON Feature with a LineString geometry ready to drop into geojson.io. A small SVG preview draws the path to scale on a normalized grid (north points up) with green and red dots marking the start and end, and a stats panel shows the bounding box, total path length via the haversine formula on a spherical Earth (radius 6,371 km), and the point count. Everything runs locally in your browser. Your coordinates are never uploaded.
Free to use. Works in your browser. No signup, no login.
Related tools
You may also like
GPS Coordinate Converter
Convert latitude and longitude between DD, DMS, and DDM.
Open tool
ConverterGeohash Converter
Two-way geohash converter with precision, bounding box, and neighbor cells.
Open tool
ConverterUTM Coordinate Converter
Convert WGS84 lat/lon to UTM (zone, easting, northing) and back, with scale factor and convergence.
Open tool
GeneratorGoogle Maps Link Generator
Build Google Maps URLs for places, directions, Street View, embeds, and geo: URIs.
Open tool
ConverterCSV to JSON Converter
Two-way CSV and JSON converter with delimiter and header controls.
Open tool