cURL to Code Converter
Free curl converter: paste a curl command, get JavaScript fetch, Axios, Python requests, Go, PHP or raw HTTP. Private — it runs in your browser.
Paste a curl command (for example from your browser's "Copy as cURL", Postman or an API reference) and this tool rewrites it as JavaScript fetch, Axios, Python requests, Go net/http or PHP cURL code, or as the raw HTTP request it sends. It understands quoting and line continuations, headers, every -d variant, --json, -F multipart uploads, basic auth, cookies, -G query strings and -k. Conversion happens in your browser, so tokens and cookies in the command never leave your device.
Runs entirely in your browser and works offline. Nothing you enter or upload leaves your device. Free, no sign-up.
Features
- Handles single, double and ANSI-C quoting and backslash line breaks
- -H, -d, --data-raw, --data-urlencode, --json, -F, -u, -b, -A, -G, -I, -k, -L
- JSON bodies become real objects (json= in Python, JSON.stringify in fetch)
- Multipart file uploads for every language
- Raw HTTP view of the request
- Secrets stay in your browser
How to use cURL to Code Converter
- Paste a curl command into the left box (multi-line commands with \ are fine).
- Pick the target: fetch, Axios, Python, Go, PHP or raw HTTP.
- Check the parsed method, URL and headers, plus any notes about flags that need attention.
- Copy the generated code or download it as a file.
Frequently asked questions
How do I copy a request as curl from Chrome?
Open DevTools (F12), go to the Network tab, right-click the request and choose Copy > Copy as cURL (bash). On Windows pick the bash version rather than cmd for the cleanest result, then paste it here.
What is the difference between -d, --data-raw and --data-binary?
-d sends the data as a form body and strips newlines; it also treats a leading @ as a file name. --data-raw is the same but never reads files, and --data-binary keeps newlines exactly. All of them make curl use POST with Content-Type application/x-www-form-urlencoded unless you set another type.
Why does the Python code use json= instead of data=?
When the body is JSON (from --json or a Content-Type: application/json header) the converter turns it into a Python dictionary and passes json=, which serialises it and sets the header for you. Other bodies are sent as a string with data=.
What does -k (--insecure) do?
It tells curl to skip TLS certificate checks. The converter carries it over (verify=False in Python, InsecureSkipVerify in Go, CURLOPT_SSL_VERIFYPEER in PHP), but you should only use it for local testing, never in production.
Is it safe to paste commands with API keys or cookies?
Yes, here. The parser runs in your browser and works offline; nothing is uploaded or logged. Still, treat the generated code as sensitive and remove secrets before sharing it.
Related tools
- JSON Formatter — Format, validate and minify JSON
- JSON to Code — Generate TypeScript, Zod, Go, Python or SQL from JSON
- URL Encoder / Decoder — Encode and decode URL components
- JWT Decoder — Decode and inspect JSON Web Tokens safely offline
- Base64 Encoder — Encode text, images and files to Base64