curl to code

Paste a curl command and get the same request as fetch, axios, httpie or Python requests.

Runs in your browser — nothing you type here is sent anywhere.
Curl command
fetch
const res = await fetch("https://api.example.com/v1/orders", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    Authorization: "Bearer sk_live_9f2a7c",
    Accept: "application/json",
  },
  redirect: "follow",
  body: JSON.stringify({
    sku: "CHS-114",
    qty: 2,
    rush: true,
    note: "leave at door",
    tags: ["gift", "fragile"],
  }),
});

if (!res.ok) throw new Error("HTTP " + res.status + " " + res.statusText);
const data = await res.json();
console.log(data);
methodPOST
urlhttps://api.example.com/v1/orders
bodyJSON · 86 B
authnone
options-L follow · --compressed
Headers · 3
Content-Typeapplication/json
AuthorizationBearer sk_live_9f2a7c
Acceptapplication/json
Notes
  • ·--compressed has no line of its own: every client here decompresses gzip already.
  • ·Top-level await needs a module context, or wrap this in an async function.

The command is tokenised the way a shell would read it, so single quotes, \" escapes and trailing \ line continuations all survive a straight paste from any docs page. A JSON body comes out as a real object literal rather than a quoted string, an urlencoded body becomes URLSearchParams, and -F becomes a FormData — with the multipart Content-Type dropped so the client can set its own boundary. Flags with no code equivalent are listed rather than silently swallowed, and nothing here leaves the tab.

Browser devtools give you a curl command with one click, which is the right format for exactly one situation. Getting it into the language you are actually working in means translating flags, headers and a body by hand.

Paste the command and pick a target. Headers, method, body, basic auth and form data are carried across, and the output is written the way you would write it rather than as a mechanical transliteration.

What people open it for

In the terminal

tools curlconv

Every utility is also a command in the desktop's shell.

More web tools

Open the full desktop, with all 47 utilities