cURL to Code (fetch / axios / Python / C# / Go)

A tool that converts cURL commands copied from your browser's developer tools or API docs into code for JavaScript (fetch, axios), Python (requests), C# (HttpClient), and Go (net/http). It handles headers, JSON, form and multipart bodies, and Basic auth, and can mask credentials. Everything runs in your browser.

Your cURL command is converted in your browser and never sent to a server. The request is never executed.

Paste a cURL command copied from your browser's developer tools (Copy as cURL, both bash and cmd) or from API docs.

Parsed request

Enter a cURL command to see its method, URL, query, headers, and body.

How to use

  1. In your browser's developer tools, right-click a request in the Network tab, choose "Copy as cURL", and paste it into the input (bash or cmd format).
  2. Choose a language tab (fetch, axios, Python, C#, or Go) to see the converted code. The "cURL" tab shows a cleaned-up cURL command.
  3. With "Mask secrets" on, Authorization, Cookie, API keys, and similar values are replaced with placeholders such as <TOKEN>. Turn it off if you need the real values.
  4. Check under "Parsed request" that the method, URL, query, headers, and body were read correctly, then copy or download the code.

About this tool

The cURL to Code tool rewrites cURL commands as HTTP request code in programming languages. It's handy for reproducing a request your browser makes in your own script, or for trying API documentation examples in a language you're comfortable with. It also pairs well with the HAR Analyzer.

It parses both bash syntax (single and double quotes, $'...' escapes, and backslash line continuations) and Windows Command Prompt syntax with ^ escapes (Chrome's "Copy as cURL (cmd)"). It supports -X, -H, -d, --data-raw, --data-urlencode, -F, -u, -b, -A, -e, -L, -k, --compressed, -G, and --url, and lists any other options it ignored.

JSON bodies are pretty-printed, and form (URL-encoded) and multipart bodies are converted to each language's standard style. Since sharing authorization headers and cookies is risky, they're replaced with placeholders by default. Nothing you enter is sent to a server, and the request is never executed.

Frequently asked questions

Does it support Windows "Copy as cURL (cmd)"?

Yes. Command Prompt syntax with ^ escapes such as ^" and ^&, and ^ line continuations, is detected and parsed automatically.

What happens to -F 'file=@path' file uploads?

File contents aren't read; instead, code that opens and sends the file in each language (open() in Python, os.Open in Go, and so on) is generated. Adjust the path for your environment. Reading request data from a file, as in -d @file, isn't supported.

Which values are masked?

Headers such as Authorization, Cookie, and X-API-Key; headers whose names contain token, secret, password, and similar words; query parameters such as api_key, token, and access_token; and Basic auth credentials given with -u. Values inside the body are not masked.

Is anything I enter sent anywhere?

No. Parsing and conversion happen in your browser, and the request is never executed.