Convert cURL to Go
Paste any curl command below and get clean, ready-to-use Go code instantly. Conversion happens entirely in your browser.
How to copy a curl command from DevTools
Most browsers can export any network request as a ready-to-paste curl command.
Chrome / Edge
- Open DevTools (F12 or Cmd/Ctrl + Shift + I)
- Go to the Network tab and reload the page
- Right-click a request → Copy → Copy as cURL
Firefox
- Open the Network Monitor in DevTools
- Right-click a request → Copy Value → Copy as cURL
- Paste it in the input above
Safari
- Enable the Develop menu in Settings → Advanced
- Open Web Inspector → Network tab
- Right-click a request → Copy as cURL
Your data stays in your browser
We never transmit, store, or log the curl commands you paste. All parsing and conversion happens client-side using JavaScript.
Watch for secrets
Curl commands copied from DevTools often contain cookies, bearer tokens, or API keys. Never share converted code without scrubbing those values first.
Learn more about converting curl to Go
Background, worked examples, and answers to common questions — the converter above does the work, this section explains how to make the most of the output.
About converting curl to Go
Convert curl to Go using the standard library `net/http` package. The generated snippet is idiomatic Go — no third-party dependencies, no `go get`, just paste and run. It handles methods, headers, request bodies, basic and bearer authentication, and proper context-based cancellation. This is the right choice for Go services, CLI tools, and any project that prefers the standard library over external HTTP clients.
Output uses
net/http
File extension: .go
How to use the Go output
- 1Paste your curl command above.
- 2Copy the generated Go snippet.
- 3Save it to `main.go` (or paste into an existing `.go` file).
- 4Run with `go run main.go` — no `go get` needed; everything is from the standard library.
- 5Read the response body with `io.ReadAll(resp.Body)` and remember to `defer resp.Body.Close()`.
Common Go examples
GET request
Fetch data from a public API endpoint.
curl https://api.github.com/repos/curl/curl
// generating example...
POST with JSON body
Send structured data with the correct content type.
curl -X POST https://api.example.com/users \
-H "Content-Type: application/json" \
-d '{"name":"Ada Lovelace","email":"[email protected]"}'// generating example...
Bearer token authentication
Pass an API key or OAuth token in the Authorization header.
curl https://api.example.com/me \ -H "Authorization: Bearer YOUR_API_TOKEN"
// generating example...
Common requests — try them in the converter
See all common Go requests →Click any example to load it into the converter at the top of the page and instantly see the Go output.
Frequently asked questions about curl to Go
Related conversions
Coming soon
Features we're building next to make curlcode the most useful tool in your dev workflow.
AI Explanation
Plain-English breakdown of headers, auth, body, and what the request actually does.
Fix my curl
AI-assisted repair for malformed curl commands and quoting issues.
Reverse conversion
Paste fetch, axios, or Python requests code and get the equivalent curl back.