๐ Runs in your browser โ nothing is uploadedโ Free, no signup
cURL to Code Converter
Paste a curl command โ for example from your browser's DevTools 'Copy as cURL' โ and get equivalent code for fetch, axios, Python requests, PHP or Go.
0 characters
JavaScript (fetch)
When should you use the cURL to Code?
- Reproducing a browser request in code using DevTools 'Copy as cURL'
- Turning API documentation examples into working code
- Moving a request from the terminal into a script or app
How to use the cURL to Code
- 1
Copy a curl command
In Chrome or Firefox DevTools, right-click a request โ Copy โ Copy as cURL. Or use an example from API docs.
- 2
Paste it
Multi-line commands with \ or ^ line breaks work.
- 3
Choose a language
fetch, axios, Python requests, PHP cURL or Go net/http.
- 4
Copy the code
Copy the code and replace any secrets with environment variables.
Examples
JSON POST to Python
curl
curl -X POST https://api.example.com/users \
-H 'Content-Type: application/json' \
-d '{"name": "Ada"}'Python
import requests
payload = {
"name": "Ada",
}
response = requests.post("https://api.example.com/users", json=payload)
print(response.status_code)
print(response.json())Common errors and how to fix them
Paste a command that starts with curl- Remove anything before curl, such as a $ prompt or a shell variable.
A quote is never closed- The command was cut off or mixes quote styles. Copy it again from the source.
More from Code Formatters & Minifiers
Free tools that run in your browser โ no signup, nothing uploaded.
SQL Formatter & Beautifier
Format SQL queries for MySQL, PostgreSQL, SQL Server, SQLite and more.
CSS Minifier & Compressor
Optimize CSS by removing whitespace and comments to accelerate page load time.
JS Minifier & Compressor
Compress JavaScript to improve website speed and performance.
XML Formatter & Validator
Format, validate and minify XML, with errors shown by line and column.
HTML Formatter & Beautifier
Beautify or minify HTML with clean, consistent indentation.
Markdown Editor & Preview
Write Markdown with a live preview and copy the HTML.
HTML to JSX Converter
Convert HTML to valid React JSX โ className, style objects and more.
SVG to React Component
Turn SVG markup into a React component with camelCase attributes.
HTML to Markdown Converter
Convert HTML to clean Markdown, including tables and code blocks.
cURL to Code FAQ
-X, -H, -d / --data / --data-raw / --data-binary, --data-urlencode, --json, -F (forms and file uploads), -u (basic auth), -b (cookies), -A (user agent), -e (referer), -G, -I and -L. Output-only flags like -s and -o are ignored.
Yes, including the Windows (cmd) version with ^ line breaks.
user:password becomes an Authorization: Basic header with the Base64-encoded credentials.
No. The tool only converts the command into code โ nothing is sent anywhere, so tokens in the command stay private.
When the body is JSON it becomes an object: JSON.stringify(...) for fetch, data for axios and json= for Python requests.
No. Everything runs in your browser, so your command never leaves your device.
