Utilo

curl Converter

Convert curl commands to JavaScript fetch, axios, Python requests, Go net/http, Node.js and PHP code, or turn fetch/requests code back into curl. Handles headers, JSON, forms, auth and multiline commands.

What this curl converter does

API docs, browser DevTools ("Copy as cURL") and Postman all speak curl, but your code probably doesn't. This tool parses a curl command, including multi-line commands with backslash continuations, and turns it into idiomatic code for JavaScript fetch, axios, Python requests, Go net/http, Node.js https and PHP cURL. It also works the other way: paste a fetch(...) call or a Python requests.post(...) call and get an equivalent curl command you can run in a terminal or share in a bug report. Parsing happens entirely in your browser, so tokens and cookies in the command never leave your machine.

How to use it

  1. Choose curl → code or code → curl at the top.
  2. Paste your command or snippet into the input box. Line breaks, \ continuations and both quote styles are handled.
  3. Pick a target language from the tabs. The output updates as you type.
  4. Read the notes under the output: flags that have no direct equivalent (for example --compressed) are listed there instead of being silently dropped.
  5. Copy the result with one click.

What is supported

  • Methods via -X, implied POST when a body is present, and -G to move data into the query string.
  • Headers (-H), cookies (-b), user agent (-A), referer (-e) and basic auth (-u), which becomes an Authorization header.
  • Bodies from -d, --data-raw, --data-binary, --data-urlencode and --json. JSON bodies are pretty-printed and emitted as native objects where the language allows it (json= in Python, JSON.stringify in JS).
  • Multipart forms with -F, including @file uploads, rendered as FormData, files= or CURLFile.
  • -k/--insecure and -L/--location are mapped to each client's equivalent option when one exists.

Tips

  • In Chrome DevTools use Copy as cURL (bash), not the cmd variant; Windows ^ escaping is harder to parse.
  • Remove secrets before pasting a converted snippet into an issue tracker.
  • For code → curl, variables defined with literal values in the same snippet are substituted; values computed at runtime cannot be.

Frequently asked questions

Is my command sent to a server?

No. The parser and code generators are plain JavaScript that run locally. You can disconnect from the network after the page loads and the tool keeps working.

Why does my converted request fail when curl works?

Browsers block some headers (Host, Cookie, Origin) in fetch and enforce CORS. Run the generated fetch code in Node.js 18+ or from your own backend instead.

Can it convert Postman collections?

Not directly. In Postman, open a request, click the Code button and choose cURL, then paste that here.

Which Python library is used?

The popular requests library. Install it with pip install requests.

Yes. All processing happens directly in your browser using JavaScript, Web Workers and Web APIs. Nothing you type, paste or upload is sent to our servers.