cURL to Code Converter (Python, JavaScript, Go…)
Developer ToolsPaste a cURL command, such as one copied from DevTools, and get the same request as code in eight languages.
Converted in your browser. The command, and any tokens or cookies in it, are never sent, stored or logged. Privacy
About
What the cURL to Code Converter does
The cURL to Code Converter turns a curl command into equivalent code as you type: Python with requests, JavaScript fetch, Node.js axios, Go net/http, PHP, Ruby, Java and C#. It handles headers, JSON and form bodies, basic auth, cookies and the multi-line commands browsers produce with Copy as cURL. A table shows the parsed method, URL, headers and body, and cookies and auth headers can be stripped first.
Steps
How to use it
- 1Paste a curl command, for example from your browser's DevTools (Copy as cURL).
- 2Choose the language.
- 3Copy the generated code; turn on Strip cookies and auth before sharing it.
Example
A real run
Input
curl 'https://api.example.com/v1/orders' \
-X POST \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer sk_test_EXAMPLE_ONLY' \
--data-raw '{"sku":"TX-1001","quantity":2}'Output
import requests
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer sk_test_EXAMPLE_ONLY',
}
json_data = {
'sku': 'TX-1001',
'quantity': 2,
}
response = requests.post('https://api.example.com/v1/orders', headers=headers, json=json_data)The JSON body becomes a json_data dictionary, so requests sets the Content-Type and serializes it. The bearer token is a dummy; turn on Strip cookies and auth to leave it out.
Options
Every setting, and when to use it
- Language
- Python requests, JavaScript fetch for browsers and modern Node.js, Node axios, Go net/http, PHP curl, Ruby net/http, Java HttpClient and C# HttpClient. The code is idiomatic for each, not a line-by-line translation.
- Strip cookies and auth
- Removes Cookie, Authorization and API-key headers and -u credentials before converting. DevTools copies a request with your session cookies, so turn this on before pasting the code anywhere.
- Parsed request
- The table below shows how the command was read: method, full URL, each header and the body, so you can check that quoting was understood before trusting the code.
Good to know
Common problems and limits
Commands up to 100 KB. Nothing is executed and no request is sent; this tool also stores nothing about a run, because commands often contain tokens.
Uncommon curl options are reported as notes when a language has no equivalent. Windows cmd-style commands with ^ escapes are normalized.
To inspect a whole recording of requests, use the HAR File Viewer; to decode a URL's parameters, use the URL Encoder.
Audience
Who uses it
- DevelopersTurn a request that works in the browser or in API docs into code for an integration, a script or a test.
- QA and support engineersReproduce a customer's failing request in Python or JavaScript from a curl command in a ticket.
- Data analystsStart a Python script that pulls data from an internal API by copying the request from DevTools.
FAQ
Frequently asked
How do I copy a request as cURL in Chrome or Firefox?
Open DevTools, go to the Network tab and reload or repeat the action. Right-click the request, then choose Copy, Copy as cURL; Chrome on Windows also offers a cmd version. Paste it here.
What is the difference between curl and Postman?
curl is a command-line tool that sends one request per command, which makes it easy to share and script. Postman is a graphical app for building, saving and testing collections of requests. Postman can import curl commands too.
Is curl only for HTTP?
No. curl also speaks FTP, SFTP, SMTP, IMAP, WebSocket and many other protocols, but HTTP and HTTPS are what most people use it for, and what these code generators produce.
What is the difference between -d and --data-raw?
-d (--data) sends data as a POST body and treats a leading @ as a file to read; --data-raw sends the text exactly as written, even with @. Browsers use --data-raw when they copy a request. Both are converted the same way.
How are cookies handled?
Cookies from -b or a Cookie header are kept in the generated code, usually as a cookies dictionary or header. They are often session cookies, so turn on Strip cookies and auth before sharing code or committing it.
Is my command sent or stored?
No. Conversion runs in your browser, the request is never sent, and this tool does not save runs.
Automation: an MCP tool convert_curl(command, language) → code and an n8n node are planned (the diff output is text). Runs of this tool are never stored.