cURL to Fetch: convert curl commands to JS, Python & Go
Paste any curl command and get clean, idiomatic code for browser fetch, Node, Axios, Python requests / httpx, and Go's net/http. Headers, JSON bodies, form data, basic auth, and cookies are all handled.
From a one-liner to typed code
A typical "copy as cURL" command from your browser DevTools becomes idiomatic code in any of the supported targets.
curl -X POST https://api.example.com/v1/users \
-H "Authorization: Bearer abc123" \
-H "Content-Type: application/json" \
-d '{"name":"Ada","role":"admin"}'const response = await fetch('https://api.example.com/v1/users', {
method: 'POST',
headers: {
'Authorization': 'Bearer abc123',
'Content-Type': 'application/json'
},
body: JSON.stringify({ name: 'Ada', role: 'admin' })
});
const data = await response.json();Where this saves you time
DevTools to code
"Copy as cURL" in Chrome/Firefox, paste here, get ready-to-paste fetch or requests code.
Onboarding from docs
Most API docs show curl. Convert once to your stack and skip the manual translation.
Stack migration
Moving from Python to Node? Convert your collected curl examples in seconds.
API integration tests
Generate a request snippet for each language you support — paste into tests.
How to convert curl to code
Paste the curl command
Multi-line commands with \\ continuations are joined automatically. The default sample uses a JSON POST so you can see the shape of the output.
Pick a target language
Use the tabs above the output: fetch, Node, Axios, requests, httpx, or Go. The code regenerates instantly for the new target.
Tweak the options
Toggle async/await, JSON parsing, or basic error handling depending on your codebase's style.
Copy or download
Paste straight into your editor, or save to request.js / request.py / request.go.
Frequently asked questions
URL, -X/--request, -H/--header, -d/--data, --data-raw, --data-binary, --data-urlencode, --json, -F/--form, -b/--cookie, -u/--user, --compressed, -L/--location, -k/--insecure, -A/--user-agent, -e/--referer, --max-time. Unknown flags are ignored with a hint.
No. The tool only parses the command and generates code — nothing is executed and no request leaves your browser.
If --json is used, or if a Content-Type: application/json header is set and the body parses as JSON, the generated code uses native objects (JSON.stringify, json= in Python, etc.).
Yes. Line continuations (\\ followed by newline) are joined before tokenising, so pasted commands from documentation work as-is.
Yes — Chrome's "Copy as cURL (bash)" output is the canonical format for this tool. PowerShell's syntax is partially supported; for best results use the bash variant.
About cURL and its conversions
cURL is the universal HTTP client. Almost every API doc shows a curl command somewhere, and every browser DevTools panel can copy a request as cURL. That makes it the de-facto interchange format for HTTP requests.
What the generator preserves
- Method: inferred from
-X, or from the presence of body flags (default POST), or GET. - Headers: emitted in declaration order, including duplicates.
- Body: JSON, raw, urlencoded form, multipart form, or binary.
- Auth: basic auth (
-u user:pass) becomes anAuthorization: Basicheader. - Cookies:
-bbecomes aCookieheader.
What it deliberately drops
-v,-s,--progress-barand other transport-only flags.--cacert,--cert,--key— these need filesystem context.