Loading cURL to Code Converter...

cURL to Code Converter

Paste a cURL command and get fetch(), Python requests, or Node axios code — instantly.

cURL Command

Generated Code

Convert a cURL Command to Working Code

Copying a request as cURL from Chrome DevTools, Postman, or an API's documentation is the fastest way to capture exactly what a request looked like — but then you still have to translate it into whatever language your app is written in. This free tool does that translation for you: paste a cURL command and get equivalent fetch(), Python requests, or Node axios code, ready to drop into your project.

How It Works

  • Paste your cURL command into the left editor, or click Sample to try an example login request.
  • Click Convert (or just keep typing — it converts automatically) to parse the method, URL, headers, body, and auth.
  • Switch tabs to see the same request as fetch(), Python requests, or Node axios code.
  • Copy or download the generated code directly into your project.

What's Supported

The converter understands the flags that show up in real-world cURL commands: -X/--request for the HTTP method, -H/--header for headers, -d/--data/--data-raw for the request body (including JSON bodies, which get converted to a proper object literal or dict), -u/--user for Basic Auth, -b/--cookie, -F/--form for multipart form uploads, and -G for converting data into query parameters. Multi-line commands copied from DevTools (with trailing \ line continuations) are handled automatically.

Privacy

Parsing and code generation happen entirely in your browser using JavaScript. Your cURL command — which often contains auth tokens, cookies, or API keys — is never uploaded to a server.

cURL to Code — Options Explained

Here's what each output format is best suited for, and how the converter handles common cURL patterns.

fetch()

The built-in browser (and modern Node) HTTP client. No dependency to install — ideal for frontend code, browser extensions, or quick scripts. JSON bodies are serialized with JSON.stringify().

Python requests

The de facto standard HTTP library for Python. JSON bodies use the json= parameter (so requests sets the Content-Type for you), and Basic Auth maps to the native auth=(user, pass) tuple.

Node axios

A popular promise-based HTTP client for Node.js and the browser. Generated code uses axios's config-object call style, with a dedicated auth option for Basic Auth credentials.

JSON Body Detection

If your -d payload is valid JSON, it's converted into a real object/dict literal (not just a string) in every output format, so the generated code stays readable and editable.

Who Uses This Tool?

Frontend Developers

Copy a request as cURL from the Network tab in DevTools, then instantly get the equivalent fetch() call to reproduce it in your app.

Backend & API Developers

Turn an API's cURL example from its documentation into working Python or Node code without hand-translating headers and body by hand.

QA & Automation Engineers

Convert a cURL command captured from a bug report or Postman collection into a Python script for a test suite.

Students & Learners

See how the same HTTP request looks across three different clients — a fast way to learn the request/response patterns of a new language or library.

Frequently Asked Questions

Where do I get a cURL command to convert?

In Chrome or Firefox DevTools, open the Network tab, right-click any request, and choose "Copy as cURL". Postman also has a "Code" button on any request that can export it as cURL.

Does it support multi-line cURL commands?

Yes. Commands copied from DevTools often span multiple lines with a trailing backslash (\) at the end of each line — the converter automatically joins these into a single command before parsing.

Does it handle authentication?

Yes, for the common cases: -u user:pass (Basic Auth) is converted to each language's native auth mechanism, and an Authorization header from -H is passed through as-is, whatever scheme it uses (Bearer, API key, etc.).

What happens to flags it doesn't recognize?

Flags that don't affect the generated HTTP call — like -k/--insecure, -L/--location, -v/--verbose, or --compressed — are safely ignored rather than causing a parse error.

Is my cURL command uploaded anywhere?

No. All parsing and code generation happens locally in your browser with JavaScript. This matters since cURL commands often contain auth tokens, session cookies, or API keys you don't want to send to a third party.

Can it convert the code back to cURL?

Not currently — this tool converts cURL to code, one direction only. If you need to inspect or format the JSON body of a request, try the JSON Formatter.

Built by Deepak Kumar — a developer who wanted a JSON tool that respects your privacy. All processing happens in your browser. Your data never leaves your device.