How I Built a Free Tool to Convert Google Maps Routes to GPX Files
The problem every cyclist knows too well
You spend 10 minutes on Google Maps dragging your route to hit that perfect scenic road. You zoom in, adjust the path to avoid the highway, add a coffee stop halfway through. The route is perfect.
Now you need to get it onto your Garmin.
And that’s where the pain starts. Garmin Connect doesn’t import Google Maps URLs. RideWithGPS wants you to sign up. Komoot wants a subscription. Some random converter site from 2015 asks
for your email and then gives you a GPX file that takes a completely different route than what you planned.
I got tired of this. So I built https://maptogpx.com.
What it does
MapsToGPX does exactly one thing: you paste a Google Maps directions URL, and it gives you a GPX file. No sign-up. No email. No account. Just paste and download.
The key difference from other tools: the GPX file contains the exact same route that Google Maps shows you. Not an approximation. Not a “similar” route from a different routing engine. The
actual route, turn by turn, road by road.
It also includes elevation data, so your bike computer knows when the big climb is coming.
How it works (the technical bit)
If you’re curious about what’s happening under the hood:
- URL parsing — Google Maps URLs are surprisingly complex. They encode waypoints, intermediate stops, route alternatives, and viewport data in a mix of path segments and protobuf-encoded parameters. The tool parses all of this — long URLs, short links (goo.gl), coordinates, addresses, and multi-stop routes.
- Google Directions API — Instead of using a third-party routing engine (which would give you a different route), the tool calls the same Google Directions API that powers Google Maps. This is why the GPX matches exactly.
- Step-level polylines — Google’s API returns route geometry at two levels: a simplified “overview” polyline and detailed step-by-step polylines. Most tools use the simplified version, which cuts corners on complex routes. MapsToGPX uses the step-level data for full resolution.
- Elevation data — Elevation is fetched from Open-Meteo’s API, which provides global elevation data for free. The tool samples elevation at regular intervals along the route and interpolates between points.
- GPX generation — The final output is a standard GPX 1.1 file that works with any device or app that reads GPX — Garmin, Wahoo, Bryton, Strava, Komoot, you name it.
The alternative route problem
One interesting challenge was handling alternative routes. When Google Maps shows you 2–3 route options, each one has a different URL. The difference is a single parameter buried in the data string: !5i1 means “second route,” !5i2 means “third route.”
The tool detects this and requests alternative routes from the API to match the one you actually selected. It’s a small detail, but it matters — you chose that route for a reason.
Why free?
I built this because I needed it. I ride every week in the Seattle area and I was tired of the workflow being broken. There’s no premium tier, no “unlock more features” paywall, no tracking.
The site runs on Vercel’s free tier and uses Google’s API free credits ($200/month, which covers roughly 40,000 conversions). Unless this somehow goes massively viral, it costs me nothing to run.
Try it at: https://maptogpx.com
- Open Google Maps and plan a route
- Copy the URL from your browser
- Paste it on MapsToGPX
- Download the GPX file
- Import into Garmin Connect / Wahoo / Bryton / whatever you use
- Ride
If you find it useful, I’d appreciate you sharing it with your riding group. And if you have feedback or feature requests, drop a comment — I’m actively developing it.
Happy riding.
