Overview / Developer & Code / cURL to Code Converter
Developer & Code 100% In-Browser & Offline

cURL to Code Converter

Turn a cURL command into JavaScript fetch, axios or Python requests code. Headers, JSON and form data, basic auth and cookies are carried over.

Paste or type your input; results appear instantly and errors are shown below the input. Fields start with an example: click one and just type to replace it.

Your files and input never leave your browser – nothing is uploaded.

Supported: method, URL, headers, JSON, form and URL-encoded data, multipart forms, basic auth, cookies, user agent and referer. Options such as -s, -v, -o and --compressed do not change the request and are skipped.

From a curl line in the docs to code in your project

API documentation shows a curl command, and browser developer tools can copy any request as one. Your project needs the same call in JavaScript or Python. Paste the command here and the equivalent code appears, with the method, headers and body already in place.

Convert a command in four steps

  1. Paste the cURL command into the left box. Multi-line commands with trailing backslashes work, and so does a leading $.
  2. Choose the output: JavaScript with fetch, JavaScript with axios, or Python with requests.
  3. Check any notes above the boxes. They list options that could not be carried over.
  4. Press Copy, or download the code as a file.

What is carried over

  • The method from -X, or POST when the command has data and GET otherwise.
  • Headers from -H, plus cookies (-b), user agent (-A) and referer (-e).
  • Request bodies from -d, --data-raw, --data-binary, --data-urlencode and --json. A JSON body becomes a real object in the code.
  • Multipart forms from -F, and -G to move data into the query string.
  • Basic authentication from -u, as a header for fetch and as auth for axios and Python.

Things to check afterwards

Options that only affect how curl prints its output, such as -s, -v, -o and --compressed, are skipped. Uploading a file with @file needs a file object in a browser, so the code uses a placeholder. -k has no browser equivalent, because browsers always check certificates. Secrets such as tokens stay in the code exactly as in the command, so move them to a variable before you commit anything.

Your command stays on this page

The conversion happens in your browser. Copied requests often contain cookies and tokens, and none of it is sent anywhere.

Frequently asked questions (FAQ)

Paste the command into the left box and choose JavaScript (fetch). The code with method, headers and body appears on the right.