FREE TOOL

curl to Go Converter

Paste a curl command, get a complete runnable Go program using net/http — headers, bodies, auth, and proxies translated. Runs in your browser, no signup.

Conversion runs entirely in your browser — the command (and any tokens or cookies in it) is never sent to a server. Tip: DevTools Network tab → right-click a request → Copy as cURL.

Scraping a real site? Skip the blocks

Hand-copied curl headers go stale, and sites still block datacenter IPs. The same request through the WebScraping.AI API gets rotating proxies, headless Chrome rendering, and unblocking in one call — your custom headers and cookies are forwarded via the headers parameter:

2,000 free API credits · No credit card required

What the generated Go code does

The output is a complete main package you can go run: http.NewRequest with the method and a strings.NewReader body, req.Header.Set for each -H header, req.SetBasicAuth for -u, and for -x an http.Transport with http.ProxyURL. The response is read with io.ReadAll and error handling is included — Go without checked errors isn't Go.

One difference from the command line: Go's default client follows up to 10 redirects on its own, so -L needs no translation. Multipart uploads (-F) need mime/multipart — the converter marks the spot rather than generating a page of boilerplate.

Frequently asked questions

How do I convert a curl command to Go?

Paste the command into the converter above — it outputs a runnable net/http program instantly, in your browser. Headers, cookies, request bodies, basic auth, and proxies are translated, with error handling included. Nothing you paste is sent to a server.

Do I need a third-party HTTP library in Go?

Usually not — net/http in the standard library covers timeouts, proxies, redirects, connection pooling, and TLS control. Libraries like resty add convenience (retries, fluent API) but the standard library is the idiomatic default, which is why the converter targets it.

How do I set a timeout on the generated request?

curl's -m maps to the client's Timeout field: client.Timeout = 30 * time.Second (add "time" to the imports). That caps the whole exchange — dial, request, and body read. For finer control use context.WithTimeout and http.NewRequestWithContext.

The Go code gets a 403 but curl works — why?

Go's TLS handshake has a recognizable fingerprint that anti-bot systems flag, independent of your headers, and datacenter IPs carry reputation penalties. Rather than fighting fingerprints, route the request through the WebScraping.AI API — rotating proxies and real headless Chrome in one GET call from Go.

Related

Go code ready? Make it unblockable.

Same request, plus rotating proxies, headless Chrome, and JS rendering — one API call from Go.

Icon