WoluTools
← About this tool

developer · Browser tool

cURL to Code Converter

Paste a curl command and read the same request back as Python, JavaScript, PHP and Go. The command is parsed the way a shell would read it, quotes and all.

Runs in your browserNothing is uploadedHow it works
Free toolNo account · no job limitFree, unlimitedRuns offline once the page has loaded.

The command

Python · requests

JavaScript · fetch

PHP · curl

Go · net/http

What the parser does

The command is read the way sh reads it, not with a regular expression. Single quotes protect everything inside them; double quotes let \", \\ and a backslash before a newline through; an unquoted backslash escapes the next character; a backslash at the end of a line joins it to the next. A leading $ prompt or the word curl is skipped. That matters because the whole point of this conversion is the awkward cases: a header value that contains a quote, a JSON body with escaped quotes inside it, a password with a dollar sign in it.

Flags that are read

-X, -H, -d with --data, --data-raw, --data-binary, --data-ascii and --data-urlencode, -F and --form-string, -u, -G, -I, -A, -b, -e, --json, --oauth2-bearer, --compressed, -L, -k, -m, --url, and a bare URL anywhere in the command. Anything else is listed above the summary as ignored rather than dropped without a word, so you can see what did not make it across.

Where the method comes from

An explicit -X always wins. Without one, -I means HEAD, a body from -d, -F or --json means POST, and everything else is GET. -G is the exception curl users forget: it moves -d data into the query string and leaves the method as GET.

Things the target languages cannot copy exactly

A browser's fetch has no way to skip certificate verification, so -k becomes a comment in the JavaScript output instead of a setting. @filename in a body or form part is left as the filename with the surrounding code to open it, because this page never touches your filesystem. And curl's --compressed is the default in Python, JavaScript and Go, so it only shows up explicitly in the PHP version.

Credentials

A curl command copied out of a browser's network tab usually carries a session cookie or a bearer token. When one is spotted the page says so above the output. It is worth reading before you paste generated code into a repository or a chat window: the token in a copied command is a live one until it expires.