Get started
HomeDeveloper ToolsCurl to Code
Developer ToolsRuns in your browser · files never uploaded

Curl to Code

cURL → fetch / axios / Python

4.6· 82 votes
Your file never leaves this browser. Everything runs on your device — no uploads, no server storage, no retention.How it works →
curl command161 chars
JavaScript283 chars
const response = await fetch("https://api.example.com/users", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "Authorization": "Bearer abc123",
  },
  body: "{\"name\":\"Ada\",\"role\":\"eng\"}",
});
const data = await response.json();
console.log(data);

What is Curl to Code?

Paste a cURL command and get back the equivalent JavaScript fetch, axios, or Python requests snippet. Handles headers (-H), body (-d), HTTP method (-X), basic auth (-u), and multi-line continuations (backslash-newline). Saves the common back-and-forth of manually translating a cURL from documentation into the language your project is written in.

How do I use Curl to Code?

  1. Paste the cURL command into the input panel.
  2. Pick a target: fetch (JS), axios (JS), or requests (Python).
  3. Copy the generated code into your project.

When should I use Curl to Code?

cURL to Code is for language translation. To test the request itself rather than generate code, use API Tester (shipping in a later phase).

Frequently asked
Which languages can I target?

JavaScript (fetch, axios), Python (requests), Node.js (http), Go, Ruby, PHP, Java, C#, Rust, and raw HTTP. Output uses idiomatic style for each language.

What does it do with auth and cookies?

Headers for Authorization, Cookie, and API-key variants are translated into the language's preferred idiom (e.g. requests auth=, axios auth { }).

Does it handle multipart / file uploads?

Yes — -F flags become the right multipart construction in each language. Binary file uploads are represented as a file read (open / fs.readFileSync / etc).

Is my file uploaded anywhere?

No. Everything runs in your browser. Your files never leave your device, and there is no server component for this tool.

Related in Developer Tools
UUID Generator
Regex Tester
Cron Generator
Cron Parser
Timestamp Converter
Unix Time Converter
API Tester
JSON to TS