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
- Choose curl → code or code → curl at the top.
- Paste your command or snippet into the input box. Line breaks,
\continuations and both quote styles are handled. - Pick a target language from the tabs. The output updates as you type.
- Read the notes under the output: flags that have no direct equivalent (for example
--compressed) are listed there instead of being silently dropped. - Copy the result with one click.
What is supported
- Methods via
-X, implied POST when a body is present, and-Gto move data into the query string. - Headers (
-H), cookies (-b), user agent (-A), referer (-e) and basic auth (-u), which becomes anAuthorizationheader. - Bodies from
-d,--data-raw,--data-binary,--data-urlencodeand--json. JSON bodies are pretty-printed and emitted as native objects where the language allows it (json=in Python,JSON.stringifyin JS). - Multipart forms with
-F, including@fileuploads, rendered asFormData,files=orCURLFile. -k/--insecureand-L/--locationare 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.