Esta página aún no está traducida al español, así que la mostramos en inglés.

cURL to Code Converter

Paste a curl command — from API docs or “Copy as cURL” in your browser’s DevTools — and get ready-to-run code for six languages, with headers, body and authentication carried over.

Actualizado el

  

Tus datos nunca salen de tu ordenador. Todo se procesa localmente en tu navegador.

Cómo usar: cURL to Code

  1. Copy a request as curl — in Chrome or Firefox DevTools right-click a request in the Network tab and choose Copy › Copy as cURL — or take a curl example from API documentation.
  2. Paste it into the curl command box. Multi-line commands with \ continuations are fine.
  3. Pick a language tab: JavaScript fetch, Axios, Node.js, Python, PHP or Go.
  4. Read the notes below the code for anything that needs your attention, then click Copy code.

What does a curl to code converter do?

curl is the universal language of HTTP examples: API documentation, Postman exports and every browser’s “Copy as cURL” feature produce curl commands. Translating one by hand into your application’s language means re-typing headers, escaping JSON and remembering how each HTTP client handles forms and authentication. This converter parses the command the way a POSIX shell and curl would, then generates idiomatic code for the client library you use.

Supported curl options

OptionConverted to
-X, --requestHTTP method (otherwise GET, or POST when a body is present)
-H, --header, -A, -e, -bRequest headers, including User-Agent, Referer and Cookie
-d, --data, --data-raw, --data-binary, --data-urlencodeRequest body (form-encoded by default, like curl); @file reads a file
--jsonJSON body with Content-Type and Accept: application/json
-F, --formMultipart form data, including file uploads with ;type= and ;filename=
-u, --user, --oauth2-bearerBasic authentication or a Bearer token
-G, --get, --url-queryData appended to the URL query string
-I, -L, -k, -m, -x, --compressedHEAD requests, redirects, TLS verification, timeouts, proxies and compression where the library supports them

Quoting follows shell rules: single quotes, double quotes with backslash escapes, ANSI-C $'…' strings (Chrome uses these for bodies containing quotes) and line continuations. Windows “Copy as cURL (cmd)” commands with ^ escapes are detected and converted too. Output-only flags such as -s, -v or -o are ignored, and anything unsupported is listed in the notes rather than silently dropped.

Choosing a target

  • JavaScript fetch — built into every browser. Cross-origin requests also need the server to send CORS headers, and browsers refuse to set headers like Cookie or Host; the converter warns you when that applies.
  • Node.js fetch — built into Node 18+, no dependency needed; file uploads use fs.openAsBlob.
  • Axios — popular for its interceptors and automatic JSON handling.
  • Python requests — JSON bodies become native dictionaries passed with json=; forms become data= dicts.
  • PHP cURL — uses curl_setopt_array with the matching CURLOPT_* constants, ideal for WordPress or Laravel code without extra packages.
  • Go net/http — a complete runnable main.go with error handling and multipart support.

Security tips

Commands copied from DevTools often contain session cookies and access tokens. The conversion runs entirely in your browser and the command is never sent anywhere or added to the URL, but remember to remove secrets before committing generated code — load them from environment variables instead. Want to try a request right away? Use the API Tester. Need to inspect a token from the command? Paste it into the JWT Decoder.

También se busca como: curl converter, curl to fetch, curl to python, curl to javascript, curl to axios, curl to php, curl to go, curl to node.

Herramientas que combinan con: cURL to Code

  • Codificación y descodificación Base64 — Convierte texto a Base64 y viceversa con compatibilidad total con UTF-8 (acentos, emojis), cambia a Base64 compatible con URL o arrastra un archivo para obtener su cadena Base64 o su URI de datos.
  • URL Encode / Decode — Percent-encode text for safe use in URLs, decode encoded strings back to readable text, and break any URL down into its parts and query parameters.
  • Formateador JSON — Pega el código JSON para formatearlo, minimizarlo o validarlo.
  • HTTP Header Checker — Fetch any URL and see exactly what the server sends back — status code, redirect chain and every response header, with a plain-English explanation of the ones that matter for SEO, caching and security.

Preguntas frecuentes

Is it safe to paste a curl command with my API key or cookies?
The command is parsed in your browser and never sent to our server or stored, and it isn’t added to the page URL. Still treat generated code like any secret-bearing file and move tokens into environment variables.
How do I copy a request as curl from Chrome?
Open DevTools (F12), go to the Network tab, reload the page, right-click the request and choose Copy › Copy as cURL (bash). On Windows, “Copy as cURL (cmd)” also works here.
Why is my -d data sent as form data and not JSON?
That mirrors curl: -d sets Content-Type: application/x-www-form-urlencoded unless you pass your own header. Add -H 'Content-Type: application/json' or use --json and the converter will produce a JSON body.
What happens to file uploads like -F file=@photo.jpg?
They become multipart uploads in every language — FormData in JavaScript, files= in Python, CURLFile in PHP and mime/multipart in Go — referencing the same local path, which you may need to adjust.
Does it follow redirects like curl -L?
fetch, Axios (in Node), Python requests and Go follow redirects by default, while curl only does with -L. In PHP the converter adds CURLOPT_FOLLOWLOCATION when -L is present.
¿Puedo instalar cURL to Code como aplicación web y utilizarla sin conexión?
Sí. cURL to Code es una aplicación web instalable (PWA): se instala desde el navegador, no se descarga desde una tienda de aplicaciones. Haz clic en «Instalar aplicación» en la parte superior de esta página en Chrome o Edge (Windows, macOS, Linux, ChromeOS) o, en Android, utiliza «Compartir» → «Añadir a la pantalla de inicio» en iPhone y iPad, o «Archivo» → «Añadir al Dock» en Safari 17+ en un Mac. A continuación, se abrirá en su propia ventana con su propio icono y, como se ejecuta íntegramente en tu navegador, seguirá funcionando sin conexión. Firefox en el ordenador de sobremesa no permite instalar aplicaciones web. Cómo funciona la instalación.

Herramientas relacionadas