cURL Converter (cURL to Code)
Convert a curl command to Python requests, JavaScript fetch, axios, PHP, Go, Java, C#, Ruby, Rust, PowerShell, HTTPie, wget or a raw HTTP request.
json= re-serializes the body (with spaces after : and ,); pass the exact text with data= if the server signs or hashes it.
| Header | Value |
|---|---|
| Authorization | Bearer abc123 |
| Content-Type | application/json |
API docs and browser developer tools ("Copy as cURL") give you requests as curl commands. This converter turns a curl command into working code for 13 targets: Python requests, JavaScript fetch, Node.js axios, PHP cURL, Go net/http, Java HttpClient, C# HttpClient, Ruby Net::HTTP, Rust reqwest, PowerShell, HTTPie, wget and a raw HTTP request. It reads the command like a shell does — single, double and $'…' quotes, backslash line continuations, and the ^ escapes of Windows cmd — and understands curl's options for method, headers, data, forms, auth, cookies, redirects and TLS.
How to use this tool
- Paste the curl command (multi-line commands with \ or ^ continuations are fine).
- Choose the language or tool to convert to.
- If the command came from Windows cmd and is not detected, choose it under "Command was copied from".
- Copy the code; read the notes for anything that could not be translated, such as @file bodies.
Formula
method: -X, else HEAD for -I, GET for -G, POST when -d/--data/--json/-F is present, otherwise GET
-d, --data-raw and --data-binary bodies are joined with & and default to Content-Type: application/x-www-form-urlencoded; --json joins pieces directly and adds Content-Type and Accept: application/json; --data-urlencode percent-encodes the value (a space becomes +); -G moves the data into the query string; -F builds a multipart form; -u (or user:password@ in the URL) becomes Basic auth (Base64 of user:password, RFC 7617); -b sets cookies; -L, -k, --compressed, -m and -x map to each library's redirect, certificate, decompression, timeout and proxy settings. JSON bodies become native objects in Python, JavaScript, PHP, Rust and HTTPie only when that keeps the exact data; otherwise, and in the other languages, the body text is sent exactly as written.
Example
The sample POST with a bearer token and a JSON body becomes Python with params = {"notify": "true"}, headers = {"Authorization": "Bearer abc123"} and json_data = {"item": "notebook", "qty": 2, "gift": False} passed to requests.post(url, params=params, headers=headers, json=json_data, allow_redirects=False) — the Content-Type header is dropped because json= sets it, and allow_redirects=False keeps curl's behaviour without -L.
Frequently asked questions
Why does the code turn off redirects?
curl does not follow redirects unless you pass -L, while most HTTP libraries do by default. The generated code keeps curl's behaviour; add -L to the command (or change the setting) if you want redirects followed.
What happens to -d @file or -F file=@path?
Files cannot be read here. Multipart file fields are written as code that opens the file by its path; a body read from a file gets a placeholder and a note.
Does it run my command?
No. The command is only parsed as text in your browser — nothing is sent anywhere, and shell variables such as $TOKEN are left as written with a warning.
Which Windows commands are supported?
cmd.exe syntax with ^ escapes, as produced by Chrome and Edge "Copy as cURL (cmd)". For PowerShell, copy the bash version instead.
Will the code send exactly what curl sends?
The method, URL, headers, body, form fields and auth match. Each library still adds its own User-Agent, Accept and Accept-Encoding headers, and the notes list anything a library cannot do the same way, such as a body on a GET request in fetch or the Host header.
Sources
Last updated:
Page address with these inputs: https://kakao.mobile/tools/curl-converter/
Cite or embed this tool
kakaoCalc. (2026, November 8). cURL Converter (cURL to Code). https://kakao.mobile/tools/curl-converter/
“cURL Converter (cURL to Code).” kakaoCalc, 8 Nov. 2026, kakao.mobile/tools/curl-converter/.
Paste this code into your page. The widget runs in your visitors' browsers, shows no ads and keeps a link back to this page. Embedding terms