Turn a cURL command into code in seconds
Almost every API documentation shows its examples as cURL commands: they are short, universal and run from any terminal. The friction shows up when you want to bring that request into your real application and have to translate the method, every header, the body and the authentication by hand. This tool does that work for you: you paste the curl exactly as you copied it from the docs, from Postman or from the "Copy as cURL" option in Chrome DevTools, pick the target language and get a snippet ready to paste. It supports the most common flags (-X, -H, -d, -u, -b, --compressed, -F, -L), detects when the body is JSON and formats it, and builds basic authentication when it finds -u. Everything runs in your browser, so you can convert requests with tokens without anything leaving your machine. Ideal for quickly testing an endpoint, migrating a docs example to your backend or understanding what a command someone handed you actually does.
How it reads your command
The converter tokenizes the command respecting single and double quotes, just like a terminal would, and it also understands line continuation with a backslash. That means a command written across several lines like this is interpreted as a single one:
curl https://api.example.com/login \\
-H "Content-Type: application/json" \\
-d '{"user":"ana","pass":"1234"}' From the tokens, the parser separates the URL, the method (if there is no -X, it uses GET, or POST when there is a body), the headers and the body. If the body starts with or [ and is valid JSON, it formats it with indentation so it looks clean in the generated code.
What it generates for each language
- JavaScript (fetch): browser style, with
fetch(url, options)and chained.then()/.catch(). Basic auth usesbtoa(). - Node.js: the native
fetchfrom Node 18 or newer, inside anasyncfunction withawait. Basic auth usesBuffer.from(...). - Python (requests): uses the
requestslibrary, withjson=when the body is JSON,data=when it is plain text,auth=(user, pass)for-uandfiles=for-F.
Reference table: cURL flags and their equivalent
| Flag | What it does | Equivalent in fetch / requests |
|---|---|---|
-X, --request | Sets the HTTP method (GET, POST, PUT...). | method: "POST" / requests.post() |
-H, --header | Adds a Key: Value header. | key in headers / headers dict |
-d, --data | Request body (implies POST). | body / data= or json= |
-u, --user | Basic authentication user:pass. | Authorization: Basic / auth=(u, p) |
-b, --cookie | Sends cookies with the request. | Cookie header / cookies= |
--compressed | Requests a compressed response (gzip). | Accept-Encoding (fetch handles it) |
-F, --form | multipart/form-data upload. | FormData / files= |
-L, --location | Follows redirects (3xx). | redirect: "follow" / allow_redirects=True |
What it is for day to day
- Migrating an API documentation example to your backend or frontend.
- Reproducing in code a request you captured with "Copy as cURL" in DevTools.
- Moving a request from Postman or Insomnia into a Python script.
- Understanding what a long
curlcommand someone shared actually does. - Quickly testing an endpoint without writing the fetch or requests boilerplate by hand.