How to use it
- Paste a curl command. Line continuations with
\(or^from Windows), single quotes, double quotes and$'…'strings are all handled like a shell would. - Pick the Language: JavaScript fetch, Node.js axios, Python requests, Go net/http or Raw HTTP.
- Copy the result. The status bar shows the method, host and target, for example
POST api.example.com → Python requests.
Example
curl -X POST 'https://api.example.com/v1/orders?notify=true' \
-H 'Content-Type: application/json' \
-d '{"sku":"KB-01","qty":2}'
becomes, with Python requests:
import requests
payload = {
"sku": "KB-01",
"qty": 2,
}
response = requests.post(
"https://api.example.com/v1/orders?notify=true",
json=payload,
allow_redirects=False,
timeout=30,
)
response.raise_for_status()
print(response.json())
When the body is JSON, the generators use native structures: JSON.stringify({...}) for fetch, a plain object for axios and a Python dict passed as json=. Other bodies are sent as strings, exactly as curl would send them.
How flags map
| curl | Result |
|---|---|
-d, --data-raw, --data-binary |
Request body; POST unless a method is set; form Content-Type if none given |
--json '{…}' |
Body plus Content-Type and Accept: application/json |
--data-urlencode 'q=a b' |
Value percent-encoded before joining with & |
-G |
Data moved into the URL query string, method GET |
-u user:pass |
Basic auth (axios auth, Python auth=, Go SetBasicAuth) |
-F name=value, -F file=@photo.jpg |
Multipart form data |
-k |
Python verify=False, Go InsecureSkipVerify; ignored in fetch and axios with a warning |
-b, -A, -e |
Cookie, User-Agent and Referer headers |
Raw HTTP prints the request line, Host, headers and body with a computed Content-Length, which is useful for documentation and for comparing what different clients send.
What isn’t converted
Only options that change the request itself are translated. Output and transfer options such as -o, -w, --retry, --max-time, --proxy and the certificate flags are read and skipped, so they don’t break parsing but don’t appear in the code either. Add timeouts, retries and proxies with your HTTP client’s own settings; the Python output already sets timeout=30 as a sensible default. Go multipart uploads from -F are left as a TODO comment, because building a multipart body in Go needs the mime/multipart package and depends on where the file comes from.
Tips
- Format the result. The output is ready to run. To match your project style, paste it into the JavaScript Formatter.
- Inspect the payload. For large JSON bodies, check the structure in the JSON Formatter before converting.
- Check query strings. If a URL contains encoded parameters, URL Encode can decode and parse them.
- Missing URL. If the command has no URL, the tool reports No URL found in the command. A URL without a scheme gets
http://added, the same default curl uses.
Frequently asked questions
Which curl options are converted?
Method (-X, -I), headers (-H, -A, -e, -b), bodies (-d, --data-raw, --data-binary, --data-urlencode, --json), multipart forms (-F), basic auth (-u), -G to move data into the query string, -L to follow redirects and -k to skip TLS checks. Options that don't affect the request, such as -o or timeouts, are ignored.
How do I get a curl command from my browser?
Open DevTools, go to the Network tab, right-click a request and choose Copy as cURL (bash). Paste it here to get equivalent fetch, axios, Python or Go code with the same headers and body.
Is it safe to paste commands with tokens?
The conversion runs in your browser and nothing is uploaded. The generated code does contain your headers, so remove Authorization tokens and cookies before sharing it or committing it to a repository.
Why does the output use redirect manual or allow_redirects=False?
curl doesn't follow redirects unless you pass -L. The generated code keeps that behavior: fetch uses redirect manual, axios uses maxRedirects 0, Python sets allow_redirects=False for non-GET requests and Go stops at the first response. Add -L to the command to follow redirects.
What happens to -d @file?
A body read from a file can't be reproduced without the file, so it is replaced with a <file contents> placeholder and a warning. Multipart -F fields that upload files become FormData entries or Python files with the file name noted.
Last updated