Skip to content
DevKit Labs

cURL to Code Converter

Turn a cURL command into fetch, Axios, Python, Go, PHP or Ruby — 100% in your browser.

cURL command
Code

About cURL to Code Converter

Paste a cURL command — the kind you copy from your browser's network tab or API docs — and get the equivalent HTTP request in real code. It parses the method, URL, headers, request body and basic auth (including quoting, `\`-line continuations and common flags) and generates JavaScript fetch, Axios, Python requests, Go net/http, PHP cURL or Ruby Net::HTTP.

It's the fastest way to move from a quick command-line test to code in your app. Everything is parsed and generated locally in your browser; nothing is uploaded.

POST with a JSON body

Input
curl -X POST https://api.example.com/users -H "Content-Type: application/json" -d '{"name":"Ada"}'
Output
fetch("https://api.example.com/users", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: "{\"name\":\"Ada\"}",
})

Switch the target to Axios, Python, Go, PHP or Ruby.

Frequently asked questions

Which languages can it generate?

JavaScript (fetch), Axios, Python (requests), Go (net/http), PHP (cURL) and Ruby (Net::HTTP). Pick the target from the dropdown.

Does it handle headers, JSON bodies and auth?

Yes. It reads -H headers, -d/--data and --json bodies, and -u basic auth (converted to an Authorization header). The method defaults to POST when a body is present.

Does it run the request?

No. It only converts the command to code — nothing is sent anywhere. You run the generated code in your own environment.

Is my command uploaded?

No. Parsing and code generation happen entirely in your browser.

Related tools

References