curl to Code
Paste a curl command and get fetch / axios / Python requests / Go snippets — headers, data and url-encoding flags parsed automatically.
>_ USAGE GUIDE
Paste a curl command and get a code snippet in fetch / axios / Python requests / Go. It parses common flags such as -H, -d, --data-urlencode, -u and -b automatically and maps them into the target language's request construction. Grab a command from the browser DevTools "Copy as cURL" and paste it here for readable code.
Knowing how the flags map helps you check the output: -X sets the method, -H is a header, -d is the request body (and from it the Content-Type is inferred), -u is Basic auth and -b is a cookie. Note the difference between -d and --data-urlencode: the latter URL-encodes the data before sending, and the two are handled differently when generating code — if the server expects form-encoded data, use --data-urlencode.
- Copy the curl from DevTools: in the Network panel choose "Copy as cURL" for the target request
- Paste the command: drop the whole command in
- Pick the target language: switch between fetch, axios, Python and Go
- Verify the method and headers: confirm the method, URL and headers
- Copy the code: take it into your project
>_ FAQ
Q1 · Which target languages are supported?
Common targets such as fetch, axios, Python requests and Go are supported. Language boundaries differ slightly (Go, for instance, needs a body reader constructed explicitly); the output aims to follow each language's idiomatic style, so pasting into a project usually needs only minor variable renaming.
Q2 · What is the difference between -d and --data-urlencode?
-d sends the data as-is as the request body, usually form content by default; --data-urlencode URL-encodes the data before sending, suited to parameters with special characters. The two generate different constructions, so if the server expects encoded form data, make sure the command uses --data-urlencode.
Q3 · Is the generated code ready to run?
Largely yes, with two caveats. First, the code embeds the original URL, headers and body and may contain secrets such as tokens, so do not commit it as-is. Second, complex options (file uploads, certificates, proxies) may be unsupported; when so, the output flags the skip and you complete it by hand.
Q4 · What if a complex curl flag is not recognized?
The tool runs a hand-written curl subset parser covering -X / -H / -d / --data-urlencode / -u / -b / -A / -e / -I and similar; for complex options like -F uploads, certificates and proxies it skips them with a warning rather than emitting wrong code. When something is unrecognized, follow the warning and add the equivalent logic yourself.
Q5 · Does the conversion actually send the request?
No. Conversion is purely static text parsing and code generation; it makes no network request and never executes the command you pasted. Your URL, headers and body are only parsed locally, so debugging is safe.