Skip to content

cURL Converter

Paste a curl command and get working code in Python, JavaScript, Node.js, Go, PHP or Ruby. Headers, JSON, forms, file uploads and auth are all converted, entirely in your browser.
import requests

url = "https://jsonplaceholder.typicode.com/posts"
headers = {
    "Content-Type": "application/json",
    "Authorization": "Bearer YOUR_TOKEN",
}
json_data = {
    "title": "Hello",
    "body": "From curl",
    "userId": 1,
}

response = requests.post(
    url,
    headers=headers,
    json=json_data,
)
print(response.json())

Converted in your browser. Commands often contain API keys, so nothing is sent anywhere or saved.

How to convert a curl command to code

  1. Paste a curl command into the box: from API documentation, a terminal, or your browser's dev tools.
  2. Pick a language. The converted code updates as you type.
  3. Copy it into your project. Warnings below the code flag anything that needs your attention, like files.

Copy any request from your browser as cURL

In Chrome, Edge or Firefox, open the developer tools, go to the Network tab and reload the page. Right-click a request and choose Copy → Copy as cURL. Paste it here to replay that exact request from your own code. Both the bash and Windows (cmd) formats work; headers your HTTP library sets itself, like Content-Length and Host, are dropped automatically.

Supported languages

LanguageLibraryConverter
Pythonrequestscurl to Python
JavaScriptfetchcurl to JavaScript
Node.js (axios)axioscurl to Node.js (axios)
Gonet/httpcurl to Go
PHPcURLcurl to PHP
RubyNet::HTTPcurl to Ruby

Supported curl options

OptionConverted to
-X, --requestHTTP method (GET, POST, PUT, PATCH, DELETE…)
-H, --headerRequest headers
-d, --data, --data-raw, --data-binaryRequest body (JSON, form-encoded or raw text)
--data-urlencode, -GURL-encoded data, in the body or the query string
--jsonJSON body with JSON Content-Type and Accept headers
-F, --formMultipart form fields and file uploads
-u, --user, --oauth2-bearerBasic auth or a bearer token
-A, -e, -bUser-Agent, Referer and Cookie headers
-L, -k, -mFollow redirects, skip TLS checks, timeout
-I, --headHEAD request

Output-only options like -s, -v, -i and --compressed are ignored. Anything the converter can't express (proxies, client certificates, reading data from files) is listed as a warning instead of silently dropped.

Building an AI agent? Turn the same command into an OpenAI or Claude tool definition, or an MCP server, with the AI Tool Generator.

Every conversion is tested: we send the same request with curl and with the generated code and check that the method, URL, headers, auth and body match.

Frequently asked questions

How do I copy a request as cURL from Chrome?

Open DevTools (F12), go to the Network tab and reload. Right-click the request, choose Copy, then Copy as cURL (bash). Paste it here. Chrome's Windows (cmd) format works too.

Is it safe to paste commands that contain API keys?

Yes. The conversion runs entirely in your browser; nothing you paste is sent to a server, logged or saved. Still, rotate any key you've shared publicly.

Which curl options are supported?

URL, -X/--request, -H/--header, -d/--data, --data-raw, --data-binary, --data-urlencode, --json, -F/--form, -u/--user, -G/--get, -I/--head, -A, -e, -b (cookie strings), -L, -k, -m/--max-time, -T and --oauth2-bearer. Options that only change curl's own output (-s, -v, -i, -o, --compressed) are ignored, and anything else is listed as a warning.

Why does my converted code show a placeholder for -d @file?

curl reads the body from that file when the command runs. The converter can't see your files, so it leaves a placeholder for you to replace with the file's contents or a file read.

More free developer tools