Curl to Code Converter

Convert curl commands to code in 9 languages, or reverse-convert code back to curl.

Curl commandPaste a curl command (multi-line \ is fine)
PythonGenerated code
Nothing to convert yetPaste a curl command on the left, or try a
Waiting for inputProcessed locally

How to use it

  1. Paste a curl command (or choose an example) — multi-line commands with \ are fine.
  2. Pick a language: Python, JavaScript, Node.js, Go, Java, PHP, Rust, C# or Ruby; the code updates as you type.
  3. Copy or download the code, or switch to Code → Curl to turn HTTP code back into a curl command.

Related tools

API TesterWeb & APIJSON FormatterFormatURL Encoder & DecoderConvert

What is Curl to Code Conversion?

Curl to code converts curl commands into equivalent source code in multiple programming languages. When you copy a request as curl from browser DevTools or API documentation, this tool generates idiomatic code for Python (requests), JavaScript (fetch), Go, Java, PHP, Rust, C#, and Ruby — ready to paste into your project.

Common use cases

  • Converting browser DevTools curl commands to Python or JavaScript
  • Translating API documentation curl examples to your language
  • Generating HTTP client code from Postman curl exports
  • Learning how curl options map to language-specific HTTP libraries
  • Quickly prototyping API integrations in any language

Frequently asked questions

How do I copy a request as curl?

In Chrome/Firefox DevTools, go to the Network tab, right-click any request, and select 'Copy as cURL'. This captures the full request including headers, cookies, and body. Paste it into this tool to generate code.

Does it handle all curl options?

It supports the most common options: -X (method), -H (headers), -d (data), -u (auth), -b (cookies), -F (form data), --data-raw, --compressed, and -k (insecure). Backslash line continuations and quoted strings are handled correctly.