curly{bits}

curlybits / cURL Converter

cURL Converter

Paste a curl command, such as one from your API docs or Copy as cURL in the browser's developer tools, and get the same request as JavaScript fetch, Axios or Python requests code. Headers, JSON and form bodies, basic auth, cookies, timeouts and redirects are all carried over.

cURL command
Code

      

How to use the cURL Converter

  1. Paste a curl command into the left box. Multi-line commands with \ (bash) or ^ (Windows) line breaks work too.
  2. Choose JavaScript fetch, Axios or Python requests.
  3. Check the summary under the code: method, URL, headers and body type, plus notes on anything that couldn't be converted.
  4. Click Copy and paste the code into your project.

Copy as cURL from your browser

The fastest way to reproduce a request a web page makes: open developer tools (F12), go to the Network tab, right-click the request and choose Copy → Copy as cURL. Chrome on Windows offers cmd and bash versions; both can be pasted here. Copied requests often include many browser headers (sec-ch-ua, sec-fetch-*, accept-language) that you can usually delete.

What gets converted

curlMeaningIn the code
-X, --requestHTTP methodmethod (POST is assumed when there's a body)
-H, --headerHeaderheaders
-d, --data, --data-raw, --jsonRequest bodyJSON is turned into an object; a=1&b=2 into form fields
--data-urlencodeURL-encoded fieldEncoded and added to the body
-F, --formMultipart form and file uploadFormData / files=
-u, --userBasic authAuthorization: Basic / auth
-b, --cookieCookiesCookie header / cookies=
-G, --getSend data in the query stringAdded to the URL / params=
-L, -k, -mFollow redirects, skip TLS checks, timeoutRedirect, TLS and timeout options

fetch, Axios or requests?

fetch is built into every browser and into Node.js 18 and later, so it needs no install. Axios adds automatic JSON handling, timeouts and interceptors and works the same in old browsers and Node. Python requests is the standard choice for scripts, tests and data work. See cURL to Python for Python-specific tips.

Redirects

curl does not follow redirects unless you add -L, while fetch, Axios and requests follow them by default. That's usually what you want, so the generated code keeps the default. If you need to see the redirect itself, add redirect: "manual" (fetch), maxRedirects: 0 (Axios) or allow_redirects=False (requests).

Frequently asked questions

Is my curl command sent anywhere?

No. It's parsed and converted in your browser. That matters because copied commands often contain tokens, cookies and passwords.

Why does the browser block my fetch call when curl works?

Browsers enforce CORS: the server has to allow requests from your page's origin. curl, Node.js and Python don't have that limit. Run the code on a server, or ask the API owner to allow your origin.

Can I convert to Node.js?

Yes. Choose JavaScript fetch: Node.js 18 and newer have fetch built in. Axios also works in Node.

What about -k / --insecure?

Python gets verify=False and Axios gets an HTTPS agent that skips certificate checks. Browsers never allow skipping them. Only use this for local testing.

My command has several URLs or uses a config file.

Only the first URL is converted, and -K config files can't be read. Anything skipped is listed under the code.

Updated

Add this cURL converter to your website

Free for blogs, schools and businesses. Copy the code below and paste it into your page's HTML. The tool works exactly like this one and runs in your visitors' browsers, so nothing is uploaded. Please keep the credit line so others can find it too.

Preview embed ↗