cURL to Code Converter
Local ProcessingConvert a cURL command into JavaScript, Python, PHP, Go, Java or C# code.
How It Works & Processing Standards
Convert a cURL command into JavaScript, Python, PHP, Go, Java or C# code.
Tool processing runs in your browser. If you create a calculator or conversion share link, its values are included in the URL. See the privacy policy for account, analytics and advertising data.
Current Limits
- Maximum input length: 100,000 characters
Choose a language under "Task". Move examples from API docs or "Copy as cURL" in developer tools straight into your code. The command is only read, never run.
What You Can Do
- Six languages
- JavaScript, Python, PHP, Go, Java, C#.
- Headers and body
- Reads -X, -H and -d into the code.
How to Use cURL to Code Converter
- 1Choose a languagePick the target language.
- 2Paste cURLPaste the curl command.
- 3Copy the codeCopy the generated code.
Examples
POST → fetch
Input: curl -X POST https://api.example.com/items -H 'Content-Type: application/json' -d '{"name":"a"}'
Result: const response = await fetch("https://api.example.com/items", {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: "{\"name\":\"a\"}",
});
GET → Python
Input: curl https://api.example.com/items -H 'Authorization: Bearer TOKEN'
Result: response = requests.get(
"https://api.example.com/items",
headers={
"Authorization": "Bearer TOKEN",
},
)
Common Use Cases
- Moving curl examples from API docs into app code
- Reproducing a request copied from developer tools
Frequently Asked Questions (FAQ)
What if there is -d but no -X?
Like curl, a body implies POST and no body implies GET.
