Curl-to-Code Converter

Convert curl commands to fetch, Python & PHP

Paste a curl command and instantly get equivalent JavaScript fetch, Python requests and PHP code, with headers, body and auth handled — all in your browser.

Generated code will appear here. Paste a curl command above to begin.

About the curl-to-code converter

curl is the universal language for describing HTTP requests, but translating a long curl command into application code by hand is tedious and error-prone. This converter parses the curl flags and emits ready-to-run code for three popular environments.

Supported flags include the URL, -X (method), -H (headers), -d/--data/--data-raw (request body), -u (basic auth), -k (skip TLS verification),-L (follow redirects) and --compressed. Quoted strings and line continuations are handled, so multi-line curl commands paste cleanly.

Output languages

  • JavaScriptfetch() with async/await.
  • Python — the requests library.
  • PHP — the native curl_* extension.

How to use the curl-to-code converter

  1. Paste your curl command

    Copy a curl command (from browser DevTools "Copy as cURL" or the docs) and paste it in.

  2. Pick a language

    Switch between JavaScript, Python and PHP tabs to see each version.

  3. Copy the code

    Click Copy to grab the generated snippet for the active language.

Frequently asked questions

Which curl flags are supported?
The URL, -X (method), -H (headers), -d/--data/--data-raw (body), -u (basic auth), -k (insecure), -L (follow redirects) and --compressed. Quoted strings and backslash line continuations are handled.
Why does my POST become a GET in the output?
It does not — if a -d body is present and no -X flag is set, the method defaults to POST automatically, matching curl's own behavior.
Can I paste the curl command from Chrome DevTools?
Yes. Use "Copy as cURL" in the Network panel and paste it straight in; the multi-line, quoted format is supported.
Does it handle multipart file uploads (-F)?
Not yet. Multipart form uploads are not parsed; use -d with a JSON or form-encoded body for best results.
Is my curl command sent to a server?
No. Parsing and code generation happen entirely in your browser.

I want to…

Common reasons people reach for the curl-to-code converter — see if it matches your task.

  • Convert a curl command into JavaScript fetch code
  • Turn curl into Python requests code
  • Generate PHP HTTP code from a curl command
  • Translate curl headers and POST body into code