cURL to Code
Supported flags: -X, -H, -d / --data / --data-raw / --data-binary / --data-urlencode / --json, -F, -u, -b, -A, -e, -k, -L, -I, --url. Multiple -d values are joined with & exactly like curl does. Anything else is listed under the output instead of being silently dropped.
About cURL to Code
Paste a curl command copied from the DevTools Network panel, an API doc or a blog post and get runnable code for five targets: Python (requests), JavaScript (fetch), Node.js (axios), PHP (cURL) and Go (net/http).
The mapping follows what curl actually does, not what looks familiar. A few outputs look unusual because of that, deliberately:
- No Content-Type is invented. With
-d, curl sendsapplication/x-www-form-urlencodedby default. Many converters "helpfully" switch to JSON, which then does not match what the server expects. This follows curl and adds a note below the output: if the body is JSON, add-H 'Content-Type: application/json'. - Multiple
-dvalues are joined with&— curl's own rule, not a bug. -u user:passbecomes a ready-madeAuthorization: Basic ...header, with the base64 computed in the browser so each language does not need its own version.-kproduces the "skip certificate verification" form (verify=Falsein Python,VERIFYPEER => falsein PHP) with a warning underneath. It is not a recommendation — it translates the intent in your command.--data-urlencodeis passed through as written, not encoded here: encoding belongs in your code, and pre-encoding hides the original value.
Multipart (-F) is generated in full only for Python and PHP. JavaScript gets a FormData skeleton; Node and Go are left for you, because a mime/multipart boilerplate runs twenty lines and would make the output harder to use than to write.
Unmapped flags are never silently dropped: --http2, -s, -v and similar are listed below the output so you know what was not translated.
What you get is a minimal skeleton that runs — no retries, no refined error handling, and timeout=30 in the Python version. Fill those in to taste.
Parsing and generation happen in the browser; tokens in the command are never uploaded.
Frequently asked questions
Does the generated code behave exactly like curl?
Method, URL, headers and body match. Deliberate differences — such as not inventing a Content-Type — are listed under the output.
Why is -d not treated as JSON automatically?
curl sends application/x-www-form-urlencoded by default with -d. Switching to JSON silently can break the request.
Why is --data-urlencode not encoded?
Encoding is your code's job. Pre-encoding hides the original value and makes it harder to adjust.
Can it convert file uploads?
-F key=@path produces full code for Python and PHP, a FormData skeleton for JavaScript, and needs manual work in Node and Go.
Is the token in my command uploaded?
No. Parsing and generating happen in the browser, never on a server.