Converters

cURL to Code Converter

Paste a curl command and get equivalent code in JavaScript (fetch), Python (requests), Node.js (axios), or HTTPie. The converter parses all common curl flags: -H headers, -d/--data body, -X method, --auth, --compressed, -L follow redirects, and more. Great for turning a curl command from API docs into ready-to-use code.

cURL to Code — Convert a curl command into fetch, Python requests or axios code

What it does

  • Converts curl commands to JavaScript fetch, Python requests, axios, or HTTPie
  • Parses -H/--header flags into proper header objects
  • Handles -d/--data and --data-raw for POST/PUT request bodies
  • Supports -X/--request for specifying HTTP methods
  • Handles -u/--user for Basic Auth credentials
  • Preserves URL, query parameters, and cookies

Use cases

  • Converting a curl command from API documentation into application code
  • Generating Python requests code from a curl command for a script
  • Creating axios code for a Node.js project from a curl example
  • Translating a curl command into HTTPie for terminal use

How it works

1

Paste your curl command into the input pane

2

Select the target language (fetch, Python, axios, HTTPie)

3

The tool parses the curl flags and generates equivalent code

4

Copy the generated code into your project

Frequently asked questions

1Does it handle multipart form data?

Yes. curl commands with -F flags (multipart/form-data) are converted to the equivalent multipart form submission in the target language. For Python, this becomes the files parameter in requests. For fetch, it uses FormData.

2What about --compressed and -L flags?

The tool handles --compressed (adds Accept-Encoding: gzip) and -L (follow redirects). These are translated to the appropriate options in each target language.

3Can it handle complex curl commands with variables?

The tool parses standard curl syntax. Shell variables ($VAR) in the command are preserved as-is in the output code — you'll need to replace them with your language's variable interpolation syntax.

Related tools

Use cURL to Code offline in Devinity

All 95 tools run locally on your Mac. No internet required, no data sent to servers.

Download Devinity →