cURL to Code Converter
Paste a curl command, for example from your browser's developer tools (Copy as cURL) or API documentation, and get equivalent code in more than 40 languages and libraries: Python requests, JavaScript fetch, Axios, PHP Guzzle, Go, Java, C#, Ruby, Rust, PowerShell, HTTPie and more.
Private by design: anything you enter is processed in your browser only. It is never uploaded to or logged on our servers. The command is parsed locally, so tokens and cookies in it stay on your device. No request is sent to the URL.
Bash syntax (quotes, \ line continuations, $'…'). Windows ^ continuations from Chrome's "Copy as cURL (cmd)" are converted automatically.
Warnings
About the cURL to Code Converter
curl is the lingua franca of HTTP: API documentation shows requests as curl commands, and every browser's developer tools can copy a request "as cURL" with all of its headers, cookies and body. Turning that command into code by hand is tedious and easy to get wrong, especially quoting, form encoding and multipart uploads. This converter does it for you.
It is built on the open-source curlconverter project. The command is parsed with a real Bash grammar (tree-sitter), so single and double quotes, $'…' strings and backslash line continuations are understood the same way your shell would. curl's option parser is reimplemented too, so short options can be combined (-sSL) and long options abbreviated.
When the target library cannot express part of the command, for example a curl option with no equivalent, a file that is read from disk, or several URLs in one command, the converter still produces code and lists what was dropped under Warnings. Review them before you ship the generated code.
The generated code includes every header from the command. Requests copied from a browser contain session cookies and tokens: remove the ones you do not need and never commit real credentials. To look at a token in the command, use the JWT decoder; to inspect a JSON response, try the JSON beautifier or compare two responses with the JSON diff tool.
Reference Guide
curl options most often seen in copied commands, and how they are converted:
| Option | Meaning | In generated code |
|---|---|---|
-X, --request | HTTP method | Method argument (GET is implied, POST when there is a body) |
-H, --header | Request header | Headers map / object |
-d, --data, --data-raw | Request body (form-encoded unless a Content-Type is set) | Body string, form data or a JSON object when the body is JSON |
--data-urlencode | URL-encoded form field | Form field, encoded by the library |
-F, --form | multipart/form-data field or file (@file) | Multipart body with a file reader |
-G, --get | Send -d data as the query string | Query parameters |
-u, --user | Basic authentication | Library auth helper or an Authorization header |
-b, --cookie | Cookies | Cookie map or Cookie header |
-k, --insecure | Skip TLS certificate verification | Verification disabled (avoid in production) |
-L, --location | Follow redirects | Redirect option where the library needs one |
--compressed | Ask for gzip/brotli and decompress | Usually implicit |
Example input
curl -X POST https://api.example.com/v1/users \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer YOUR_TOKEN' \
-d '{"name": "Ada Lovelace", "email": "ada@example.com", "roles": ["admin"]}'
This sample loads automatically when you open the tool. Use Load Sample to bring it back.
Was this tool useful?
Thanks for your feedback!
Could not send your feedback. Please try again later.
Frequently Asked Questions
Open the developer tools (F12), go to the Network tab, right-click the request and choose Copy > Copy as cURL (bash). Paste it here and pick the language you need. The cmd variant from Windows is converted automatically.
More than 40 targets, including Python requests, JavaScript fetch, Axios and other Node.js clients, PHP cURL and Guzzle, Go, Java, Kotlin, C#, Ruby, Rust, Swift, Dart, PowerShell, HTTPie, wget, Ansible, raw HTTP, HAR and JSON.
Some curl options have no equivalent in the chosen library, or the command does something the generated code does not, such as sending several URLs or reading a file. The code is still generated and each warning tells you what was left out so you can add it by hand.
No. The command is parsed and converted in your browser and no request is made to the URL. Remember to remove real tokens and session cookies from the generated code before you share or commit it.
The parser follows curl's own option list, so a typo or an option from a different tool is rejected. Check the spelling, or remove the option if it is not a curl flag.
Related Tools
All Developer Utility Tools →Text Diff Checker
Compare two text blocks and highlight differences side by si...
JSON Diff
Compare two JSON documents structurally, match array items b...
Word Counter & Character Count Tool
Count words, characters, sentences, paragraphs, and estimate...
PDF to Word Converter
Convert PDF to an editable Word document (DOCX) with heading...
PDF to Excel Converter
Extract tables from a PDF into an Excel spreadsheet (XLSX) w...
Repair PDF
Fix PDFs that will not open: rebuild the broken cross-refere...