Skip to content
MtrXTools

HTTP request converter

Paste a curl command, such as one copied from the browser's Network panel, and get the same request as JavaScript fetch or Python requests code, with headers, body, form fields, auth and timeouts. Nothing is sent; the command is only parsed. Runs in your browser.

Last updated

What it does

  • Turns a curl command into equivalent JavaScript fetch code (for browsers and Node.js 18+) or Python requests code.
  • Understands the options people actually paste: -X, -H, -d and --data-raw, --data-urlencode, --json, -F form fields and file uploads, -u basic auth, -b cookies, -A, -e, -G, -I, -L, -k and --max-time, including bundled flags such as -sSL.
  • Handles shell quoting, $'...' strings from Chrome's "Copy as cURL" and line continuations from bash (), Windows cmd (^) and PowerShell ( ).
  • Writes JSON bodies as real objects (JSON.stringify({...}) or json= in Python) and splits query strings into Python params.
  • Notes anything that behaves differently, such as headers browsers won't let fetch set, -k, and redirects (fetch follows them by default; curl only with -L).

Getting a curl command

In Chrome, Edge or Firefox, open DevTools, go to the Network panel, right-click a request and choose Copy, then "Copy as cURL" (choose the bash version on Windows). The command includes your cookies and tokens, so remove them before sharing the code.

Questions

Does it run the command?
No. The command is only parsed in your browser, and no request is sent anywhere.
Why doesn't my Cookie header work in the browser?
Browsers don't let fetch set Cookie, User-Agent, Referer and a few other headers. The generated code works as written in Node.js; in a browser, cookies are sent with credentials: "include" for the same site.
What about options it doesn't support?
They are listed under the code as "Not converted", so nothing is dropped silently. Client certificates and AWS signing, for example, need library-specific code.