🔁 cURL to Code Converter
Convert cURL commands to Python, JavaScript, PHP, Go, and more. Paste a curl command and get clean code instantly. Free online cURL converter for developers.
How to Use
1
Paste your cURL command
Paste your full curl command (starting with "curl") into the input area. Multi-line commands with \ are supported.
2
Choose a language
Click a language tab: Python, JavaScript, PHP, or Go. The code updates instantly.
3
Copy the code
Click Copy to copy the generated code. It handles headers, auth, and JSON bodies.
Frequently Asked Questions
What is a cURL command?
cURL is a command-line tool for making HTTP requests. Developers use it to test APIs, download files, and debug network requests. Format: curl [options] URL. Common flags: -X (method), -H (header), -d (data), -u (auth).
What languages are supported?
This tool generates code for Python (requests library), JavaScript (fetch API), PHP (curl extension), and Go (net/http package). Each output is idiomatic and production-ready.
How do I convert a curl with headers?
Include -H flags in your curl command, e.g.: curl -H "Authorization: Bearer token" -H "Content-Type: application/json" https://api.example.com. All headers are extracted and included in the generated code.
Does it support POST with JSON body?
Yes. Include -d '{"key":"value"}' or --data-raw with your JSON. The tool detects JSON content and formats it properly for each language.
What about Basic Auth?
curl -u username:password is supported and converted to the appropriate auth mechanism in each language: HTTPBasicAuth in Python, btoa() in JS, CURLOPT_USERPWD in PHP, and SetBasicAuth in Go.
Guide : Convertisseur cURL vers Code
Qu'est-ce que c'est ?
Le convertisseur cURL vers Code transforme les commandes cURL en code équivalent pour JavaScript (fetch, axios), Python (requests), PHP et d'autres langages.
Cela évite de réécrire manuellement les appels API copiés depuis la documentation ou DevTools.
Comment utiliser
- Collez votre commande cURL dans le champ d'entrée.
- Sélectionnez le langage cible (JavaScript, Python, PHP…).
- Le code équivalent s'affiche dans le panneau de sortie.
- Copiez et intégrez directement dans votre projet.
Conseils professionnels
- Dans Chrome DevTools → Network, faites clic droit sur une requête → "Copy as cURL" puis convertissez ici.
- Vérifiez que les tokens d'authentification ne sont pas exposés dans le code copié.