1. Home
  2. Developer
  3. cURL Converter

cURL Converter

Paste a cURL command and get fetch, axios, Python or Go code.

Runs in your browser · No upload
Paste the output of Copy as cURL (bash) from your browser dev tools as is.
Converted code
const response = await fetch('https://api.example.com/v1/orders', { method: 'POST', headers: { 'Content-Type': 'application/json', 'Authorization': 'Bearer YOUR_TOKEN', }, body: JSON.stringify({ item: 'book', qty: 2, gift: false, }), }); const text = await response.text(); console.log(response.status, text);

Parsed request

FieldValue
MethodPOST
URLhttps://api.example.com/v1/orders
HeadersContent-Type, Authorization
BodyJSON
Review the generated code before using it in production. Read tokens and passwords from environment variables instead of writing them into code.

Your command is processed in this browser and never sent to a server.

How to use

  1. Paste a cURL command into the input. In Chrome or Edge dev tools, right-click a request in the Network tab and choose Copy as cURL (bash) (Firefox: Copy as cURL (POSIX)), then paste it as is.
  2. Pick the target: JavaScript fetch, axios, Python requests or Go net/http. The code updates as you type or switch targets.
  3. Read any warning shown below the input. It points at things you have to finish by hand, such as file uploads or options that were skipped.
  4. Use Copy or Download to take the code. The table at the bottom shows how the method, URL, headers and body were understood.

Supported options

curl option What it becomes
-X, --request The method. Without it: POST when there is a body, HEAD for -I, otherwise GET
-H, --header A header. Repeating a name keeps the last value; Name: with no value removes it
-d, --data, --data-raw, --data-binary The body. Several flags are joined with &
--data-urlencode URL-encodes the value and adds it to the body
--json Sets the body plus Content-Type and Accept to application/json
-F, --form multipart/form-data. @path attaches a file, ;type= sets the MIME type
-G, --get Moves -d data into the URL query string instead of the body
-u, --user Basic auth (user:password)
-A, -e, -b User-Agent, Referer and Cookie headers
--oauth2-bearer An Authorization: Bearer header
-m, --max-time Timeout in seconds
-k, --insecure Skip certificate verification (axios, Python, Go)
-s, -S, -v, -i, -o and similar Output flags; they do not appear in the code

Example

A POST with a Content-Type: application/json header and a JSON body becomes the idiomatic form in each language. This is the Python result from this tool:

import requests

response = requests.post(
    'https://api.example.com/v1/users?active=true',
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
    },
    json={
        'name': 'Kim',
        'tags': ['a', 'b'],
        'ok': True,
        'n': None,
    },
    timeout=10,
)

Python’s json= argument sets Content-Type: application/json itself, so that header is dropped from the code, and JSON true and null become True and None. If the body does not parse as JSON it is sent as a plain string. A form body such as -d 'a=1&b=hello%20world' becomes URLSearchParams in fetch and a data={...} dictionary in Python, with %20 decoded to a space.

Things to know

  • When -d is used without a Content-Type, curl sends application/x-www-form-urlencoded. This tool applies the same rule and writes the header into the code explicitly.
  • Redirect handling follows each library’s default. Without -L, curl does not follow redirects, but fetch, axios and requests do. Add redirect: 'manual', maxRedirects: 0 or allow_redirects=False yourself if you need curl’s behavior.
  • JSON that contains integers of 16 digits or more is kept as a string, because JavaScript would lose precision when turning it into an object.
  • If the command contains a token or password, that value ends up in the generated code. Read secrets from environment variables before committing the result, and review the generated code before using it in production.
  • To build query strings separately, try the Query String Builder. Status code meanings are in HTTP Status Codes, and request or response JSON can be tidied with the JSON Formatter. For tokens in headers there is the JWT Decoder, and for encodings the Base64 Encoder/Decoder and URL Encoder/Decoder.

Frequently asked questions

How do I copy a cURL command from Chrome?

Open dev tools (F12), go to the Network tab, right-click a request and choose Copy, then Copy as cURL (bash). The cmd variant escapes characters differently, so the bash format is more reliable here.

Can I run the converted code as is?

Usually yes, but anything that cannot be carried over automatically, such as @file uploads, proxies or unknown options, is flagged with a warning. Add your own error handling and timeouts and review the code before it goes into production.

Does it handle commands with a pipe?

If the command ends with a pipe or redirect such as curl ... | jq ., only the curl part is converted and a warning is shown.

Does it work for multi-line commands?

Yes. Lines joined with a trailing backslash, single and double quoted strings and $'...' strings are unquoted the way a shell would. An unclosed quote is reported as an error.

Is my command sent to a server?

No. The conversion happens entirely in your browser and no request is made.

Your command is processed in this browser and never sent to a server.

Can't find the tool you need?

Tell us what you want to do. We build the most requested tools first.