cURL to Code Converter

Turn a shell curl command into a ready-to-run HTTP request across five languages, parsed entirely in your browser.

Paste a curl command and read it back as working code in the language you actually ship. This curl converter pulls the method, URL, headers, request body, and basic-auth flags out of the command, then rewrites them as a JavaScript fetch call, a Node axios config, a Python requests script, Go net/http, or a PHP curl handle. It copes with the awkward parts of a real command line: single and double quotes, backslash line continuations, `-XPOST` glued to its value, and stacked short flags like `-sSL`. Reach for it when you grab a request from Chrome's "Copy as cURL" or an API doc and need it as JavaScript or Python instead of a shell one-liner.

curl command
JavaScript (fetch)

How it works

  1. 1

    Paste the curl command

    Drop a full `curl ...` line into the left pane. Line continuations, quoted JSON bodies, and repeated -H headers all parse as they are, so there's no need to flatten the command to one line first.

  2. 2

    Pick a target language

    Choose JavaScript fetch, Node axios, Python requests, Go net/http, or PHP curl from the Target menu. The right pane rewrites the request the moment you switch.

  3. 3

    Copy or download the code

    Grab the generated snippet with Copy, or save it as a .js, .py, .go, or .php file to drop straight into your project.

Instant & 100% private — nothing is uploaded

Everything runs locally in your browser. Your code, text and files are processed on your own device and are never sent to a server — so there are no upload waits, no size limits from us, and nothing is ever stored or logged.

Frequently asked questions

How do I convert a curl command to fetch?
Paste the command and pick the JavaScript (fetch) target. Given `curl -X POST https://api.x.com/v1/items -H 'Content-Type: application/json' -d '{"a":1}'`, you get a `fetch()` call with method "POST", a Content-Type header, and the JSON payload as the body, followed by an `await res.json()` line ready to paste into an async function.
Can it turn curl into Python requests?
Yes. The Python target emits a requests script: a `url` variable, a `headers` dict, a `data` value, and the matching call such as `requests.post(url, headers=headers, data=data)`. Uncommon verbs like PURGE fall back to `requests.request("PURGE", url)` so any method still works.
Does it handle -u basic auth and -L redirects?
It does. `-u user:pass` becomes an `Authorization: Basic …` header in fetch, an `auth` object in axios, an `auth=(...)` tuple in Python, and `SetBasicAuth` / `CURLOPT_USERPWD` in Go and PHP. `-L` maps to the follow-redirects option in the languages that need one set.
Which curl flags does the parser read?
Method (`-X`/`--request`), the URL, repeatable headers (`-H`), request bodies (`-d`, `--data-raw`, `--data-binary`, `--data-urlencode`), basic auth (`-u`), user-agent (`-A`), cookies (`-b`), referer (`-e`), plus `-L`, `-k`, and `-G`, which moves data onto the query string. Noise flags such as `-s` and `--compressed` are ignored so they don't clutter the output.