Skip to content
MyDevToolbox

Curl to Code

Client-side

Translate curl commands into Python, JavaScript, Go and more.

Runs 100% in your browser · Inputs are saved only in this browser, if you allow it


  

From curl to working code in seconds

curl is the universal language of HTTP examples: API documentation, Postman, Insomnia and the “Copy as cURL” option in your browser's DevTools all produce curl commands. Turning one into application code by hand means translating every header, body and flag – and it is easy to get subtly wrong. This converter parses the command exactly like a shell would and generates idiomatic code for Python (requests), JavaScript (fetch), Node.js (axios), Go (net/http) and PHP (cURL).

What is supported

  • Methods (-X), headers (-H), user agent, referer and bearer tokens.
  • Bodies with -d, --data-raw, --data-binary, --data-urlencode and --json. JSON bodies become native objects; form bodies become dictionaries.
  • Multipart uploads with -F, including files (-F file=@photo.jpg).
  • Basic auth (-u), cookies (-b), -G query strings, -I, -L redirects, -k, timeouts and grouped flags such as -sSL.
  • Multi-line commands with bash \, Windows ^ or PowerShell ` continuations, and $'…' quoting.

The generated code mirrors curl's behaviour: for example, redirects are only followed when the command uses -L, and -d sends application/x-www-form-urlencoded unless you set another content type. Options without an equivalent are listed under Notes instead of being silently dropped.

Private by design

curl commands copied from DevTools often contain session cookies and API keys. The conversion runs entirely in your browser, so nothing is sent to our servers. The last command is kept in localStorage for convenience; use Clear Data to remove it.

Practical example

In Chrome or Firefox, open DevTools, go to the Network tab, right-click a request and choose Copy → Copy as cURL (bash). Paste it here, pick your language and you have a reproducible request for a test, a script or a bug report. Remember to remove headers you do not need – browsers add many, such as sec-ch-ua or accept-language.