Toolich
Important tasks

100% Local & Secure

All utility tools process your data entirely in your browser. No inputs or files are ever sent to a server.

Dark mode

cURL to Code

New Tab (Alt+A)

Convert curl commands to JavaScript fetch, Axios, Python requests, Go, PHP and Java code — privately, in your browser.

Documentation & User Guide

cURL to Code Converter Guide

curl is the lingua franca of HTTP: API documentation shows examples as curl commands, and every browser can copy a request from DevTools as one. Turning that command into application code by hand means translating each flag — methods, headers, bodies, form uploads, authentication and TLS options — without missing anything. This converter parses the command exactly the way your shell and curl would and generates equivalent, ready-to-run code for JavaScript fetch, Axios, Python requests, Go net/http, PHP cURL and Java HttpClient.

⚙️ Key Features

  • Understands bash quoting ('…', "…", $'…'), backslash line continuations and combined flags such as -sSL or -XPOST.
  • Supports -X, -H, -d / --data-raw / --data-binary / --data-urlencode, --json, -F multipart uploads, -u basic auth, -b cookies, -A, -e, -G, -I, -L, -k, -m, -x and --oauth2-bearer.
  • JSON bodies become native objects (a JavaScript object, a Python dict) instead of escaped strings.
  • Form bodies become URLSearchParams or a Python dict, keeping repeated keys.
  • Output for six targets: JavaScript fetch, Axios, Python requests, Go, PHP and Java, with syntax highlighting, copy and download.
  • Warns about options it can't translate and flags commands that contain tokens, cookies or passwords.

📖 How to Use

  1. Paste a curl command into the left panel, or click 'Sample'. In browser DevTools, right-click a request in the Network tab and choose Copy → Copy as cURL (bash).
  2. Pick the output language from the tabs above the code.
  3. Read any warnings below the panels — for example about files the command reads from disk.
  4. Copy or download the code, and move secrets such as tokens into environment variables before committing it.
🔒
Privacy & Security:

The curl command is parsed and converted locally in your browser with JavaScript. Nothing is uploaded, logged or stored, so tokens, cookies and passwords in the command never leave your device.

Frequently Asked Questions (FAQ)

Why does my request become a POST when I didn't use -X?

That's how curl behaves: any -d, --data-* or --json option makes curl send a POST with the data as the body, and -F sends a multipart POST. The generated code reproduces what curl would actually send. Use -G to send the data as a query string with GET instead.

What Content-Type does -d use?

Unless you set one yourself, curl sends -d data as application/x-www-form-urlencoded, even if it looks like JSON. The converter adds that header so the code behaves identically. Use --json, or add -H 'Content-Type: application/json', for JSON APIs.

Does the converter support Windows 'Copy as cURL (cmd)' commands?

Line continuations with ^ (cmd) and ` (PowerShell) are understood, but cmd's ^-escaping of quotes is not. For the most reliable result, copy the request as cURL (bash), which works on every platform.

Is it safe to paste commands with API keys or cookies?

Yes. Parsing and code generation happen entirely in your browser; the command is never sent to a server or stored. Commands copied from DevTools usually include session cookies, so treat the generated code as a secret until you remove them.

Assistant & feedback