cURL Converter

Convert curl commands to JavaScript fetch, Axios or Python requests code. Handles headers, JSON bodies, form uploads, basic auth and DevTools 'Copy as cURL'.

Built & Maintained by the devtoolspack Team

Last updated: September 2026

Turn curl Commands into Working Code

API documentation, bug reports and browser DevTools all speak curl. Your application does not. This converter reads a curl command the way a shell would, including single and double quotes, $'...' strings and line continuations, and writes the same request as JavaScript fetch, Axios or Python requests code.

What Gets Translated

  • Method: taken from -X, or inferred the way curl does (POST when there is a body, HEAD with -I).
  • Headers and cookies: every -H, plus -b, -A and -e.
  • Bodies: JSON becomes an editable object; form-encoded and raw bodies stay exact.
  • File uploads: -F file=@photo.jpg becomes FormData or Python files=.
  • Auth: -u user:pass becomes a Basic auth header, Axios auth or Python auth=.

Watch for Secrets

Commands copied from DevTools usually include session cookies and bearer tokens. Conversion happens entirely in your browser, so nothing is uploaded, but remember to move those values into environment variables before committing the generated code.

Related Tools

Tidy a JSON body with the JSON Formatter, decode an Authorization token with the JWT Decoder, or escape query values with the URL Encoder.

How to Convert a curl Command to Code

  1. Paste the curl command: Paste a curl command, for example from DevTools Copy as cURL (bash).
  2. Pick a language: Choose JavaScript fetch, Axios or Python requests.
  3. Copy the code: Copy the generated code and replace any secrets with environment variables.

Frequently Asked Questions

How do I get a curl command from my browser?

Open DevTools, go to the Network tab, right-click a request and choose Copy > Copy as cURL (bash). Paste it here to get equivalent fetch, Axios or Python code with the same headers and body.

Which curl options are supported?

Method (-X), headers (-H), bodies (-d, --data-raw, --data-binary, --data-urlencode, --json), multipart forms (-F), basic auth (-u), cookies (-b), user agent (-A), referer (-e), -G to move data into the query string, -I for HEAD and -k for skipping TLS verification. Output-only flags such as -s, -L and --compressed are ignored.

Why is my JSON body converted to an object?

When the Content-Type is JSON and the body parses cleanly, the code uses JSON.stringify (fetch), a data object (Axios) or json= (Python) so it is easy to edit. Anything else is kept as the exact original string.

Does it handle Windows "Copy as cURL (cmd)"?

Line continuations with ^ are understood, but cmd escapes quotes differently from bash. For best results, choose "Copy as cURL (bash)" in DevTools, which works on every platform.

Cite this Tool

Using this tool for a technical blog, research, or documentation? Copy a pre-formatted citation below to link back to devtoolspack.

APA Citation
devtoolspack. (2026). cURL Converter. https://devtoolspack.dev/curl-converter
MLA Citation
"cURL Converter." devtoolspack, 2026, https://devtoolspack.dev/curl-converter.