HTTP Request to Code Converter
Turn a curl command or raw request into fetch, Python and curl code.
Runs in your browser. Nothing is uploaded — your input is processed on this device and discarded when you close the tab.
HTTP Request to Code Converter
How to use this tool
- Paste a curl command or a raw HTTP request. Headers, method, URL and body are read from what you paste.
- Convert. You get the same request as JavaScript fetch code, Python requests code and a cleaned-up curl command.
- Check before running. The converter copies what you pasted; it does not verify that the endpoint exists or that the credentials are right.
Worked example
Paste the sample: curl -X POST https://example.com/api/users -H "Content-Type: application/json" -d '{"name":"Ada"}'. The fetch output uses method "POST", the same URL, a headers object with Content-Type application/json, and the body string {"name":"Ada"}. The Python output is the matching requests.post call.
What this tool does not do / Limits
Only the request you paste is converted; nothing is sent anywhere by this tool. Basic authentication (-u user:password) is turned into an Authorization header, which means the converted code contains the encoded credentials — do not share it. Cookies, multipart bodies and curl flags beyond method, headers, data and basic auth are not carried over.
Frequently asked questions
Can I paste a request copied from my browser’s network tab?
Yes, if you copy it as curl. A raw request (a request line, headers, a blank line, then the body) works too.
Does the tool run the request?
No. It only writes code. You run the code yourself, in your own environment.
Related tools
JSON Studio
Format, validate, minify, query and compare JSON in your browser, with precise line-and-column errors.
LiveRegex Tester
Test patterns against sample text with match highlighting, capture groups and a safe one-second timeout.
LiveSecurity Header and DNS Checker
Check HSTS, CSP and other security headers, TLS details, and DNS/email authentication records (SPF, DKIM, DMARC).
Live