cURL Converter

cURL Converter

Paste a curl command and get the same request as JavaScript fetch code and Python requests code, ready to paste into your own project.

Your JavaScript fetch code will appear here.

About the cURL Converter

The cURL Converter reads a curl command and rewrites it as code you can run. It picks out the request method, the URL, the headers, the request body, and basic auth, then produces the same request as JavaScript fetch code and as Python requests code.

It understands the options people use most: -X and –request for the method, -H and –header for headers, -d, –data, –data-raw, –data-binary, and –json for the body, –user for basic auth, plus –user-agent and –cookie. Other curl options are ignored, because they have no direct equivalent in fetch or requests code.

How to use

  1. Paste a curl command in the box. You can paste it with line breaks and backslashes, as copied from a browser or a terminal.
  2. Click Convert.
  3. Switch between the JavaScript fetch tab and the Python requests tab to see each version.
  4. Use Copy shown code to copy the version you are looking at.

Key features

  • Converts to JavaScript fetch code and Python requests code in one click
  • Reads method, URL, headers, body data, and basic auth
  • Handles single quotes, double quotes, and escaped characters in the command
  • Guesses POST automatically when the command sends data and no method is given
  • Clear error messages when the command has no URL or a header is malformed

Frequently asked questions

What if my curl command has no -X method?

The converter uses GET when there is no request body, and POST when the command sends data with -d or –data. That matches how curl itself behaves.

How is basic auth converted?

A –user name:password option becomes an Authorization: Basic header in the JavaScript code, and an auth tuple in the Python code. The password is encoded in base64, exactly as HTTP basic auth requires.

Does it send the request anywhere?

No. The tool only converts the text of your command into code. Nothing is sent to any server, and your command never leaves your browser.

Why is part of my curl command missing from the output?

Options such as –compressed, -k, -L, and –max-time control how curl itself behaves, and they have no direct equivalent in fetch or requests code, so they are left out. The request itself is unchanged.

Can I convert a command copied from browser developer tools?

Yes. Commands copied as cURL from the Network tab usually work as-is, including their headers and data. If a header is missing its colon, the tool tells you which one.

Free to use, no signup needed. This tool runs entirely in your browser — your data never leaves your device.