Generated code will appear here.

Free Online cURL to Code Converter

Paste a raw curl command — like the one your browser's DevTools copies from the Network tab — to instantly generate the equivalent JavaScript fetch, Axios, or Python requests code. It is useful when an API request works in curl but needs to become browser fetch, Axios, or Python code for an application.

Why convert a curl command to code?

API documentation and browser DevTools both commonly express an HTTP request as a curl command — it's a universal, copy-pasteable format for describing a request's method, URL, headers, and body. But when you need that same request inside an application, you need it as actual code in your language of choice, and manually translating flags like -H and -d into the right object shape is tedious and easy to get wrong.

How to use this converter

Paste the full curl command — multi-line commands with trailing \ continuations are supported — choose a target (JavaScript fetch(), Axios, or Python requests), and click Convert.

What gets parsed

  • -X / --request — the HTTP method (defaults to GET, or POST if a body is present)
  • -H / --header — request headers
  • -d, --data, --data-raw, --data-binary — the request body
  • -u / --user — HTTP Basic authentication, converted into an Authorization header
  • -A / --user-agent and -b / --cookie — added as their corresponding headers

How to use cURL to Code Converter for related tasks

Paste the complete curl command, convert the request, and verify headers, authentication, query parameters, and body encoding before running it.

Related tools: REST API Tester, Query String Parser.

Frequently asked questions

Where do I get a curl command to paste here?

Most browser DevTools (Chrome, Firefox, Edge) let you right-click a request in the Network tab and choose "Copy as cURL" — that's the most common source, along with curl commands from API documentation.

Does this support every curl flag?

It covers the flags used in the vast majority of real-world API requests: -X/--request, -H/--header, -d/--data(-raw/-binary), -u/--user, -A/--user-agent, and -b/--cookie. Less common flags (like client certificates or proxy settings) aren't translated into the generated code.

Is my curl command uploaded anywhere?

No — parsing and code generation both happen entirely in your browser. If your curl command includes an API key or token, it never leaves your machine.

Why does the generated code just print the response instead of doing something with it?

The generated snippet is a starting point showing the equivalent request — logging the response is the simplest way to show it works. You'll typically replace that part with your own handling.

Why does generated fetch code behave differently from curl?

Browsers impose CORS and forbidden-header rules that command-line clients do not; compare the generated request with the server policy.