loot.tools

cURL to Code Converter

Paste a curl command and get the same request as JavaScript fetch, Node axios, or Python requests. The method, headers, JSON or form body, and basic auth all carry over, and a JSON body is pretty-printed into a real object instead of a quoted string. Handy when you copy a request out of your browser's network tab or an API doc and need it as code. It runs entirely in your browser.

Paste a curl command and get the equivalent request code. Method, headers, JSON or form body, and basic auth all carry over. Nothing is sent anywhere - the conversion runs in your browser.

Output:
curl command
Request code

What this tool does

It reads a curl command the way your shell would - quotes, escapes, and backslash line continuations included - then rebuilds the same HTTP request in the language you pick. It works out the method from -X or from whether there's a body, splits each -H header into a key and value, collects -d data, and reads -u credentials as basic auth. The result is ready-to-run code, not a rough sketch.

Why you'd use this

Copying a request as curl from your browser's network tab is easy. Turning that into working fetch or requests code by hand is the annoying part, especially once headers and a JSON body are involved. Paste the curl, pick fetch, axios, or Python, and copy code you can drop straight into your app or a quick script.

What carries over

Headers, the request method, basic auth from -u, and the request body all transfer. A JSON body (set by a Content-Type of application/json, or one that just looks like JSON) is parsed and printed as a real object so you can edit it, while form-style bodies stay as a string. The -G flag folds your data into the query string. Flags that only affect curl's own output, like -s, -L, or -o, are ignored.