cURL Converter
Convert any cURL command to working code in Python (requests, httpx, urllib), JavaScript (fetch, axios, node-fetch), Go (net/http), or PHP (curl, Guzzle). Handles headers, JSON bodies, basic auth, query strings, multipart uploads, and cookies. Paste a cURL command, pick a language, get copy-pasteable code.
How to use the cURL Converter
Paste a cURL command into the input — including line continuations (\) and multi-line
formatting. Pick your target language, click Convert, and copy the result. The
output is ready to run; for languages with library dependencies (axios, httpx, Guzzle), the import
statements at the top show what's required.
For browser DevTools workflows: right-click on a request in the Network panel and choose Copy → Copy as cURL. Paste that into the input. Out comes equivalent code in your language of choice. This is the fastest way to reproduce a browser request in a script.
What the converter handles
The parser walks the cURL command as a shell-tokenized command line. Quoting (single, double, escaped) is handled the way bash would handle it. Recognized flags map to language idioms:
-X POST→ method argument or function name (e.g.,requests.post)-H 'k: v'→ headers dict / object / map-d '...'→ request body; JSON content-type is detected and serialized in the language's idiomatic way-u user:pass→ basic auth via the library's native auth parameter-F 'k=v',-F 'file=@path'→ multipart form (files become placeholders)--data-urlencode→ form-encoded body fields- Query strings in the URL are preserved as-is; for languages where idiomatic style separates URL and params, the params are extracted
Per-language notes
Python requests is the default because nearly every Python project has it and the
output is one line per concept. httpx is identical in API but supports async; pick
it if you're working in an asyncio codebase. urllib output is
verbose but uses only stdlib — useful for serverless functions or scripts that need zero
dependencies.
JavaScript fetch output works in the browser and Node 18+ without dependencies. axios is more concise for interceptors and timeouts. Node https is the streaming-friendly stdlib path; verbose but no external dependency.
Go net/http output is idiomatic — explicit request building, explicit error handling, explicit body close. PHP curl uses procedural-style cURL bindings; Guzzle is the framework-friendly choice for Symfony/Laravel codebases.
Common use cases
- API docs to code. Most API documentation includes cURL examples; converting them to your language is faster than reading and re-typing.
- Reproducing a browser request. Copy as cURL from DevTools, convert, run — much faster than building the request from scratch.
- LLM API calls. OpenAI's, Anthropic's, and Google's docs all lead with cURL. Convert to your language to integrate quickly.
- Webhook testing. Provider docs give you a cURL command to test the webhook; convert to a script you can run repeatedly.
- Postman replacement. A simple cURL + this converter often beats opening Postman, importing, and re-exporting.
Frequently asked questions
Which cURL flags does the converter understand?
-X / --request (HTTP method), -H / --header, -d / --data / --data-raw / --data-binary (body), -u / --user (basic auth), --url, --compressed, -G / --get (force GET with body as query), --form / -F (multipart), -b / --cookie, -A / --user-agent, -e / --referer. Less common flags (--cert, --insecure, --http2) are noted as comments in the output rather than translated.Can I paste the cURL command Chrome's DevTools generates?
Does the converter preserve the request body exactly?
Which Python library does the Python output use?
requests by default — the closest equivalent to a one-line cURL and present in nearly every Python environment. Switch the output to httpx if you want async support or HTTP/2. urllib is offered for stdlib-only environments.Does this tool send the cURL command anywhere?
What about cURL's --data-urlencode flag?
--data-urlencode key=value becomes an individual encoded form field; --data-urlencode @file becomes a placeholder comment because file contents aren't available client-side.