Skip to main content

cURL to Code

New

Paste a curl command and get equivalent JavaScript (fetch), Python (requests), and Node.js (https) code.

curlcode generatorfetchpythonnodejsapi
Read the guide
Shortcuts:⌘ KSearch
Parsing…
JavaScript (fetch)
—
Python (requests)
—
Node.js (https)
—

Handles the common flags: -X/--request, -H/--header, -d/--data/--data-raw, -u/--user, and a bare URL. More exotic curl flags (--form, cookie jars, client certs) are not translated.

Continue with:

Frequently Asked Questions

Which curl flags are supported?

The common ones: -X/--request for the HTTP method, -H/--header for headers, -d/--data/--data-raw/--data-binary for the request body, -u/--user for basic auth, and a bare URL. Common no-op flags like -s, -i, -L, -k, and --compressed are recognized and ignored.

What happens with more exotic curl flags?

Flags this tool doesn't specifically handle (like --form for multipart uploads, cookie jars, or client certificates) are simply not translated into the generated code — the output will be missing that behavior, so double-check generated code against the original command for complex requests.

Does the Python output use requests.json= or requests.data=?

The tool tries to JSON-parse the curl -d body first; if it parses successfully, it generates `json=...` (so requests sets the Content-Type and serializes for you). If it's not valid JSON, it falls back to `data=...` for a raw string/form body.

Is the generated code guaranteed to run without edits?

It's meant as a strong starting point, not a guaranteed drop-in — for example, generated fetch/Node code doesn't handle streaming responses, retries, or advanced auth flows that a hand-written client might need.

Does anything get sent to a server when I paste my curl command?

No — parsing and code generation both happen entirely in your browser with JavaScript. This is especially relevant since curl commands often contain API keys or bearer tokens in headers.

Related Tools