Convert a curl command into a Python requests call with the right arguments
Runs in your browser. Nothing you type is sent anywhere. Updated on 25 Oct 2026.This turns a curl command into a requests call that reads like something a person would write: json= for a JSON body with the dictionary spelled out, data= for a form, files= for uploads, auth= for -u, params folded into the URL for -G, and timeout= for --max-time. True, False and None replace their JSON spellings, and raise_for_status is added so failures do not pass silently.
Paste the curl command into the curl command box; Python requests is already selected.
Check the summary line for the method, URL and body type that were read from the command.
Read the requests call: json= for a JSON body, data= for a form, files= for uploads and auth= for -u.
Press Copy, or download the code as request.py.
Paste a curl command and get the same request written as browser fetch, Node fetch, Python requests, PowerShell Invoke-RestMethod or HTTPie. The command is split the way a shell would split it, so quoted values, escaped characters and lines joined with a backslash, a caret or a backtick all survive.
Where a target cannot do what curl did, the generated code says so instead of quietly producing something wrong. A page cannot turn off certificate checking or set a Cookie header, so those become comments. Multipart uploads drop an explicit Content-Type, because only the library knows the boundary. PowerShell switches that need version 6 are labelled.
Nothing is ever executed and no request is made. The parser and every generator run in this page, which matters because a pasted command usually contains a live bearer token, a session cookie or a password. It stays in your browser. Even so, swap the secret for an environment variable before the generated code goes into a repository.
The rest of the article, and all 6 questions about curl Converter, are on the curl Converter page.
Paste the whole command, starting with the word curl, and pick fetch. Headers become an object, -d becomes the body, a JSON body is written as JSON.stringify with the object laid out, and -u becomes an Authorization header built with btoa. Copy the result with one click.
Never. The command is only ever read as text and split the way a shell would split it. No request is made, no file is opened and nothing is executed, so it is safe to paste a command you have not read carefully yet.
In Windows PowerShell, curl is an alias for Invoke-WebRequest, which takes completely different arguments, so -H and -d are read as something else entirely. Convert the command to PowerShell here to get a real Invoke-RestMethod call, or install curl.exe and call it by its full name.
Yes. Right-click a request in the Network tab and choose Copy as cURL. Those commands use --data-raw, --compressed and a long list of lower-case headers, and are often one very long line or several joined with backslashes. All of that is handled, including the $'...' form Chrome uses when a value contains newlines.
Still stuck? Ask about curl Converter and anybody who knows can answer. No account needed.
Same job, other tools: HEX to RGB – Turn a hex colour code into rgb() values you can paste into CSS.
On the related tools: TSV to JSON – Convert tab-separated values, such as a paste from Excel, into JSON · Query String Parser – Split a URL query string into a table of decoded parameters.
In the collection Developer Converters.