cURL Command to Code Converter
Führung
cURL to Code Converter
Paste a curl command and instantly get the equivalent HTTP-client code in Python, JavaScript, PHP, Go, or Ruby. The converter runs entirely in your browser, parses curl with a real shell-aware tokenizer, and maps the flags you actually use — headers, JSON and form bodies, multipart uploads, basic auth, cookies, redirects, proxies, and timeouts — to idiomatic code for each target.
Unlike asking a chat assistant, the output is deterministic. The same curl command always produces the same code, with no hallucinated headers, wrong flag mappings, or invented library calls. Unsupported flags are surfaced as inline notices instead of silently dropped, so you can see exactly what the generated code does and does not cover.
Nutzung
- Paste the full curl command into the input box (line continuations with
\are fine). - Pick a target language from the dropdown — Python (requests), JavaScript (fetch or axios), Node.js (node-fetch), PHP (Guzzle or curl extension), Go (net/http), or Ruby (Net::HTTP).
- The code regenerates as you type. Use the copy button to grab it, or download to a file with the matching extension.
- If any flags could not be mapped exactly, you will see a notice listing them so nothing is lost silently.
Funktionen
- Eight output targets — Python requests, fetch, axios, node-fetch, Guzzle, php-curl, Go net/http, and Ruby Net::HTTP, all with idiomatic style.
- Shell-aware parser — handles single and double quoting, backslash escapes, line continuations, combined short flags like
-sLkund--flag=valuesyntax. - Body smart-detection — JSON payloads become typed object literals, urlencoded bodies become key/value maps, and multipart
-Fuploads become FormData or multipart parts. - Auth and cookies —
-u user:pass, Bearer tokens, and-b name=valuecookies all land in the right place for the target language. - Transport flags —
-L,-k,--compressed,-x proxy,--connect-timeout,--max-time, and HTTP version selectors are preserved. - Privacy by default — the curl command never leaves your browser. Useful when you are working with API tokens you do not want to paste into a chat service.
Häufig gestellte Fragen
-
What does the cURL command-line tool actually do?
cURL is a command-line client for transferring data over network protocols. It builds an HTTP (or FTP, SMTP, and other) request from command-line flags, sends it, and prints the response. The flags map directly to HTTP concepts — method, headers, body, authentication, redirects, TLS settings — which is why curl commands are commonly used as a portable, language-neutral way to describe an HTTP request in documentation and bug reports.
-
Why are HTTP requests in different languages structured so differently?
Each HTTP client library wraps the same wire-level request in the idioms of its host language. Python’s requests treats the request as a function call with keyword arguments. axios and fetch treat it as a config object passed to a function returning a promise. Go composes a Request struct, attaches headers, and runs it through a Client. The underlying HTTP bytes on the wire are identical — only the call sites differ. A converter translates one surface syntax to another while keeping that wire payload the same.
-
What is the difference between application/json and application/x-www-form-urlencoded bodies?
Both are common ways to send a request body, but they encode data very differently. application/x-www-form-urlencoded encodes the body as URL-style key=value pairs joined by ampersands, the same format used in a query string. application/json sends a JSON document and supports nested objects, arrays, and typed values like numbers and booleans. Servers parse the body based on the Content-Type header, so picking the right type is what makes the data readable on the receiving side.
-
Why does curl not follow redirects by default, and other HTTP clients do?
Following redirects automatically can mask bugs and create security risks — a 3xx response may redirect to a different host that should not receive the original Authorization header, for example. curl chose a conservative default that requires you to opt in with -L. Many high-level client libraries (Python requests, axios, fetch) optimize for the common case and follow redirects by default. When converting a curl command, this difference matters: code generated from a plain curl call typically needs an explicit option to disable redirect-following so that the client matches curl’s behavior.
Erweiterungen installieren
IO-Tools zu Ihrem Lieblingsbrowser hinzufügen für sofortigen Zugriff und schnellere Suche
恵 Die Anzeigetafel ist eingetroffen!
Anzeigetafel ist eine unterhaltsame Möglichkeit, Ihre Spiele zu verfolgen. Alle Daten werden in Ihrem Browser gespeichert. Weitere Funktionen folgen in Kürze!
Unverzichtbare Tools
Alle Neuheiten
AlleAktualisieren: Unser neuestes Werkzeug was added on Juni 2, 2026
