cURL to Code Converter
Turn a curl command into fetch, axios, Python requests or PHP code.
Runs in your browser Your input never leaves your device.
Paste a curl command above.
Report a problem with this tool
About this tool
Paste a curl command and pick a language. The tool reads the URL, method, headers, body, form fields and basic-auth credentials and writes the matching request in JavaScript (fetch), Node (axios), Python (requests) or PHP (cURL). Quoted strings, line continuations with a backslash and bundled flags such as -sSL are understood. If the body is JSON and the Content-Type says so, it is written as a real object instead of an escaped string. Flags that change how curl itself behaves, such as -k, -o and -v, are ignored and noted. The command is only read as text: nothing is run and no request is sent, so it is safe to paste commands that contain tokens, although you should still avoid sharing generated code that includes real secrets.
How to use it
- Copy a request from your browser's network panel with Copy as cURL, or paste your own command.
- Choose the language tab.
- Check the notes under the code for ignored options.
- Copy the code and replace any real tokens with environment variables.
Common problems
- The converted code behaves differently from curl
- curl follows redirects only with -L and sets some headers itself. Compare headers and redirect handling in your HTTP library.
- A file upload with -F @file does not work
- The code shows the field with the path as text. Replace it with a real file object or stream in your language.
- Cookies or compressed responses
- --compressed and -b are partly converted: cookies become a Cookie header, and most libraries handle compression automatically.