CodingBubbleCodingBubble

cURL Converter

Turn a cURL command into Python, JavaScript or Go code.

From terminal command to application code

API documentation and browser developer tools usually give you a cURL command. This converter reads that command and writes the equivalent request in the language you are working in, including the method, URL, headers, body, authentication and file uploads.

How to use it

Paste a command that begins with curl into the left box and pick a target language. Multi-line commands with backslashes are supported. In Chrome or Firefox you can get a command from the Network tab by right-clicking a request and choosing Copy as cURL (use the bash variant on Windows).

Supported options

The converter handles -X, -H, -d, --data-raw, --data-binary, --data-urlencode, --json, -F, -u, -A, -e, -b, -G, -I, -k and --max-time. When an option cannot be converted, a warning appears above the result so nothing is dropped silently. Shell variables and command substitution are not expanded.

Check the generated code

Treat the output as a starting point. Move API keys and tokens into environment variables before you commit the code, add error handling for non-successful status codes, and remove browser-specific headers you do not need. Redirect behavior also differs: Python, fetch, Axios and Go follow redirects by default, while cURL only does so with -L.

Frequently asked questions

Are my API keys safe here?

The command is processed in your browser and is not uploaded. Still, avoid pasting production secrets into any website when you can use a placeholder.

Does it work with Windows cmd commands?

Use the bash form of Copy as cURL. The Windows cmd form uses different quoting and is not supported.

Why does fetch fail where cURL works?

Browsers apply CORS rules and block some headers. The same code usually works in Node.js.

What happens with file uploads?

Form fields that start with @ are converted to file uploads. In JavaScript you need to supply the file contents yourself.

Related tools