Curl to code converter

Copy a request as curl from your browser dev tools or API docs, paste it here and get ready-to-run code in your language.

Private: works in your browser, nothing is uploaded.

How to use the Curl to Code tool

  1. Paste a curl command. Multi-line commands with backslashes work.
  2. Pick the language: Python, JavaScript, Node.js, Go or PHP.
  3. Copy the generated code into your project.

Supported curl options

  • -X / --request, -H / --header, -A, -e, -b (cookies)
  • -d, --data, --data-raw, --data-binary, --data-urlencode, --json
  • -F / --form for multipart uploads
  • -u for basic authentication, -G to move data into the query string
  • -k (insecure), -L (follow redirects), -I (HEAD), --compressed

Copy as cURL from the browser

In Chrome, Edge or Firefox open the developer tools, go to the Network tab, right-click a request and choose “Copy as cURL (bash)”. Paste it here to reproduce the same request in a script. Remove cookies and tokens you do not need before sharing the code.

Privacy

Everything runs in your browser. Your files and text are not uploaded to our server or stored anywhere. Commands often contain API tokens, so the conversion happens locally and nothing is sent.

Typical workflow

  • Reproduce an API call from a website in a script, for example to export your own data.
  • Turn an example from API documentation into working code in your language.
  • Share a failing request with a colleague as readable code instead of a long command.
  • Write a quick test for an endpoint you are building.

Before you share or commit the code

Requests copied from a browser contain cookies, session IDs and authorization headers that give access to your account. Remove or replace them before you paste code into a ticket, a chat or a repository. In real projects, read secrets from environment variables instead of writing them into the code.

Frequently asked questions

Does it run the request?

No. It only converts the command to code. Nothing is sent to the URL.

Is JSON body detected?

Yes. When the Content-Type is JSON and the body is valid JSON, Python uses json= and JavaScript uses JSON.stringify with a readable object.

Does it support Windows cmd curl?

Bash style commands work best. Commands from cmd with ^ line breaks and double quotes are also handled in most cases.

What about file uploads?

Form fields like -F file=@photo.jpg become files= in Python, FormData in JavaScript and CURLFile in PHP.

Why does my converted request fail with 401 or 403?

The session cookie or token from the browser may have expired, or the server checks headers like Origin or a CSRF token. Copy a fresh request and keep the headers the server needs.

Can it convert to Java, C# or Ruby?

Currently Python, JavaScript (fetch), Node.js, Go and PHP are supported. The Python or JavaScript version is usually easy to translate by hand.