cURL Converter
Converts a curl command into ready-to-use fetch, requests, PHP or Go code.
Language
What this tool does
Paste a curl command — copied from an API's docs or from DevTools' "Copy as cURL" — and get ready-to-use equivalent code in JavaScript (fetch), Python (requests), PHP or Go. The tool parses the command with its own shell tokenizer (respecting quotes, escapes and line continuation) and builds a neutral intermediate structure; each language has its own renderer over that same structure, none of them knows curl directly.
-d switches the method to POST on its own
In real curl, using -d/--data (without passing -X) switches the request method to POST automatically, even without asking for it explicitly. This tool replicates that behavior: if the original command had no -X, the generated code uses POST whenever there's a body, and GET when there isn't.
-X GET with -d really does send a body
If the command has an explicit -X GET AND also -d, real curl sends the request as GET anyway, with a body — an unusual but valid combination. This tool never "fixes" this to POST: the generated code faithfully replicates GET with a body, exactly as curl would. In JavaScript this comes with a warning comment, because the browser's fetch throws a runtime error in this specific case — Python, PHP and Go don't have that restriction.
-u becomes a computed Basic Auth header, never hidden
The -u username:password flag becomes an Authorization: Basic <base64> header, computed explicitly in the generated code — never a library convenience shortcut (like requests.auth=(...) in Python or CURLOPT_USERPWD in PHP). The idea is for the code to show exactly the mechanism, not hide the computation.
-d and --data-urlencode aren't the same thing
-d/--data sends the content exactly as typed, with no additional encoding. --data-urlencode percent-encodes the value before sending (spaces become %20, for example). When both appear in the same command, real curl concatenates every part with "&", in the order they appeared on the command line — this tool replicates that exact join, without re-encoding the parts that came from plain -d.
-F is multipart, a fully separate code path
-F/--form builds a multipart/form-data body (the format used for file uploads), structurally different from -d. A file referenced with @path can't be read by the browser — the generated JavaScript code leaves a comment indicating where to swap in a real File; in Python, PHP and Go, which run outside the browser sandbox, the code already tries to open the file from disk by the given name.
Minor flags never disappear without a trace
-k/--insecure, --compressed, -L/--location and --cookie become an explanatory comment or the real equivalent in the output language — they never silently disappear from the generated code, even when the target language has no direct equivalent (the browser's fetch with -k, for example).
Input assumed to be Bash/POSIX
This tool's tokenizer assumes Bash/POSIX shell syntax — the format of roughly 95% of API documentation and of what Chrome/Firefox DevTools' "Copy as cURL" generates. A command copied from a Windows PowerShell terminal uses different quoting and escaping rules and may not be parsed correctly.
Does my command leave the browser?
No. A curl command copied from DevTools often carries real authentication tokens and session cookies — all of this tool's processing runs entirely in your browser, with no network call whatsoever. Nothing you paste here is ever sent to any server.
Known limitations
No shell variable expansion ("$VAR", "$(command)") — everything is treated as literal text. File references in -d/--cookie aren't supported (the browser has no access to the local filesystem) and become a warning, with the part dropped instead of included as misleading text. --data-urlencode's percent-encoding uses the browser's encodeURIComponent, a very close approximation — but not byte-for-byte identical on rare punctuation — of the curl_easy_escape used by real curl.
Frequently asked questions
Because the original command had -d/--data — real curl switches the method to POST automatically in that case, even without asking explicitly. See the "-d switches the method to POST on its own" section above.
Because the original command had an explicit -X GET together with -d — an unusual but valid combination in real curl. This tool never "fixes" this to POST; it replicates it faithfully. See "-X GET with -d really does send a body".
So the generated code shows exactly the mechanism behind -u, without hiding the computation behind a target library's convenience shortcut. See "-u becomes a computed Basic Auth header".
Because -k/--insecure has no direct equivalent in some output languages (the browser's fetch, for example, doesn't allow ignoring certificate errors per request) — instead of silently disappearing, it becomes a comment explaining the limitation.
Yes — the conversion runs entirely in your browser, with no network call whatsoever. See "Does my command leave the browser?" above.
This tool assumes Bash/POSIX syntax (the most common format for API docs and for the browser's "Copy as cURL") — PowerShell uses different quoting and escaping rules, not yet supported in this version.
Because the original command had no explicit Content-Type header saying "application/json" — without that header, real curl sends the body as application/x-www-form-urlencoded even if it looks like JSON, and the generated code replicates that real behavior instead of guessing. Add -H "Content-Type: application/json" to the original command to get a native object in the generated code.
Real curl concatenates the two parts with "&", in command-line order — only the --data-urlencode part is percent-encoded, the plain -d part goes exactly as typed. See "-d and --data-urlencode aren't the same thing".
Nexinon Principles
Privacy
Your data never leaves your browser.No account needed
Use it now, no account or password.Free
No usage limits, no paid plan.Trustworthy content
Full explanation behind every tool, not just the result.