ToolJoltTools

Polyline Encoder / Decoder (Google)

Encode coordinate lists to Google's polyline format and decode any encoded polyline back — precision 5 and 6 supported. Free dev tool.

Coordinates ↔ Encoded polyline

Encoded polyline (3 points)
_p~iF~ps|U_ulLnnqC_mqNvxq`@

Encoded polyline → Coordinates

All conversion math runs in your browser — coordinates are never sent to a server.

Field guide: Polyline Encoder / Decoder

Google's encoded polyline format is how routes travel through APIs: a 200-point driving route that would be 6 KB of JSON coordinates compresses to a few hundred ASCII characters like _p~iF~ps|U_ulLnnqC. The trick is delta encoding (store the tiny differences between consecutive points, not the points), ×1e5 fixed-point integers, and a 5-bit chunked ASCII encoding. Google Directions, Mapbox, OSRM, Valhalla and GraphHopper all return geometry this way — and sooner or later every developer needs to see what's inside one. Paste it here; coordinates come out, one per line.

The precision toggle matters more than it looks: Google's standard is 5 decimal places (~1 m), but OSRM and Valhalla default to precision 6 (~0.1 m). Decode a precision-6 polyline as 5 and your route appears 10× too large, hundreds of kilometres across — the classic 'my route is in the ocean and enormous' bug. Encoding works the other way too: paste lat,lng pairs (one per line) and get the encoded string for an API request or a static-map URL. All conversion is local to your browser.

Field tips

  • Route looks 10× too big after decoding? You decoded a precision-6 polyline (OSRM/Valhalla default) at precision 5. Flip the selector and re-run.
  • Backslashes matter: polylines often arrive inside JSON where \\ is an escaped backslash. Paste the raw string value, not the JSON-escaped version, or characters will be wrong.
  • Encoded polylines are pure geometry — no timestamps, elevation or names survive. For data-rich exchange use GPX or GeoJSON; use polylines for compact display geometry.
Sources & standards: Google Maps Platform — Encoded Polyline Algorithm Format (developer documentation); OSRM API documentation — route geometry (polyline6)

Conversions run locally in your browser and follow the cited specifications. Always verify critical output in the target application; for survey-grade or legal data, confirm coordinate systems and datums with your GIS team.

Polyline Encoder / Decoder (Google) — Encode coordinate lists to Google's polyline format and decode any encoded polyline back — precision 5 and 6 supported. Free dev tool. Runs 100% in your browser: no upload, no sign-up, no size limits beyond your device.

About Polyline Encoder / Decoder (Google)

Google's encoded polyline format is how routes travel through APIs: a 200-point driving route that would be 6 KB of JSON coordinates compresses to a few hundred ASCII characters like _p~iF~ps|U_ulLnnqC. The trick is delta encoding (store the tiny differences between consecutive points, not the points), ×1e5 fixed-point integers, and a 5-bit chunked ASCII encoding. Google Directions, Mapbox, OSRM, Valhalla and GraphHopper all return geometry this way — and sooner or later every developer needs to see what's inside one. Paste it here; coordinates come out, one per line.

How to use Polyline Encoder / Decoder (Google)

  1. 1Enter coordinates (or tap 📍 to use your location) — conversion is instant as you type.
  2. 2Pick the precision/length that matches your use case; the tool explains what each level means.
  3. 3Copy the converted value with one click, or convert in the reverse direction in the lower panel.

Why use Polyline Encoder / Decoder (Google)?

  • 100% free, no sign-up, no file-size upsell games
  • Fully client-side: files and coordinates never upload to a server
  • Honest errors and warnings instead of silent bad output
  • Works offline once the page is loaded
  • Implements the documented standard: Google Maps Platform — Encoded Polyline Algorithm Format

Frequently asked questions

How does the encoding make coordinates so small?+

Three compounding tricks: coordinates become integers (×100,000, dropping sub-metre noise), each point is stored as the delta from the previous one (consecutive route points differ by tiny amounts), and the deltas are written in a variable-length 5-bit ASCII scheme where small numbers take 1–2 characters. A highway's worth of geometry routinely compresses 10:1 versus raw JSON.

What's the difference between precision 5 and 6?+

The multiplier: 1e5 (Google standard, ~1.1 m resolution) versus 1e6 (~0.11 m, used by OSRM and Valhalla by default). The formats are otherwise identical, and a string doesn't declare which it is — decode with the wrong one and every coordinate is scaled by 10. If your decoded route looks geographically absurd, try the other precision first.

Can I put a decoded polyline on a map?+

Yes — the decoder outputs lat, lng per line. For Leaflet, that's L.polyline(coords) directly. For GeoJSON (which is [lng, lat] order — swap!), wrap the pairs in a LineString. Our CSV point mapper and GeoJSON tools take it from there.

Why do my encoded characters look like line noise — is that an error?+

No, that's the format: deltas map to ASCII 63–126, so strings legitimately contain ?, @, backticks, | and ~. Two things to watch: in URLs the string must be percent-encoded, and in JSON sources backslash sequences must be unescaped before decoding — mangled escapes are the most common cause of decode failures.

Embed Polyline Encoder / Decoder (Google) on your website

Want Polyline Encoder / Decoder (Google)on your own site? Paste this snippet into any HTML page — it's free, with no API key or sign-up. The tool loads in an iframe and keeps working exactly as it does here.

Embed code
<iframe src="https://tooljolt.com/tools/polyline-encoder-decoder" width="100%" height="640" style="border:1px solid #e5e7eb;border-radius:12px;max-width:680px" title="Polyline Encoder / Decoder (Google) — ToolJolt" loading="lazy"></iframe>

Related tools

Related GIS tools

Sponsored