cURL to Code — Convert curl to fetch, Python & Go Convert a curl command to fetch, axios, Python, Go, and more.
100% offline
Input158 chars · 4 lines
Output248 chars
fetch
fetch('https://api.example.com/users', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'Authorization': 'Bearer TOKEN',
  },
  body: '{"name":"Ada","role":"admin"}',
})
  .then((res) => res.json())
  .then(console.log);

About cURL to Code — Convert curl to fetch, Python & Go

cURL is the universal language for describing HTTP requests, but you rarely ship curl — you ship code. This curl to code converter parses a curl command and rewrites it as the equivalent request in fetch, axios, Python requests, or Go, preserving the method, headers, request body, and basic auth so the result runs as-is.

It's the fastest way to turn an API doc snippet or a "Copy as cURL" command from your browser's network tab into working code. Paste once, switch target languages from the dropdown, and copy the output.

Everything runs locally in your browser. Your curl command — including any tokens, cookies, or credentials it contains — is parsed on your device and never sent anywhere.

Features

  • Convert curl to fetch, axios, Python requests, or Go
  • Preserves method, headers, request body, and -u basic auth
  • Understands quoting, line continuations, and -X / -H / -d / --data-raw
  • Runs fully offline — nothing leaves your browser

How to use

  1. Paste your curl command into the input pane.
  2. Pick a target language (fetch, axios, Python, or Go) from the dropdown.
  3. Copy the generated code from the output pane and drop it into your project.

Frequently asked questions

Which curl flags are supported?

The common ones for HTTP requests: -X/--request for the method, -H/--header for headers, -d/--data, --data-raw and --data-binary for the body, and -u/--user for basic auth. Quoting and backslash line continuations are handled like a shell.

How is the HTTP method decided?

If you pass -X explicitly, that wins. Otherwise the converter follows curl: a request with a body becomes POST, and everything else defaults to GET.

What happens to basic auth from -u?

A -u user:pass flag is base64-encoded into an Authorization: Basic header in the generated code, matching what curl sends on the wire.

Is my curl command sent to a server?

No. Parsing and code generation happen entirely in your browser. Any API keys, bearer tokens, or cookies in your command stay on your device.

Everything runs locally in your browser — your input is never uploaded.