DevKits

cURL to Python, JavaScript, Go, PHP, Java, Node.js Converter

Convert cURL commands to Python (requests), JavaScript (fetch), Node.js, Go (net/http), PHP, or Java (HttpClient). Parses -H, -d, --data-urlencode, -F, -u, --json and more. 100% local.

Last updated:

237 chars · 8 lines

Parsed request

Method
POST
URL
https://api.example.com/v1/users
Headers
  • Content-Type: application/json
  • Authorization: Bearer YOUR_TOKEN
Body
json

Paste a cURL command to generate equivalent code in Python (requests), JavaScript (fetch), Node.js, Go (net/http), PHP, or Java (HttpClient). Parses -H, -d, --data-urlencode, -F, -u, --json and more.

Tips & Best Practices

  • Copy cURL commands directly from Chrome DevTools → Network → right-click → 'Copy as cURL' to get exactly the request the browser sends.
  • The converter preserves headers, body, method, and auth. It does not translate cookies-from-file (--cookie file) — inline cookies work.
  • For gRPC, GraphQL, or streaming responses, the generated request code is a starting point; you may need to add specific client libraries.

Frequently Asked Questions

Which cURL flags are supported?

Method (-X / --request), headers (-H / --header), all body variants (-d, --data, --data-raw, --data-binary, --data-urlencode, --json), multipart form (-F / --form), basic auth (-u / --user), cookies (-b / --cookie), user agent (-A) and referer (-e). Flags that do not affect the request itself (--compressed, --insecure, --location, --silent, etc.) are recognized and ignored, and are listed under 'Ignored flags' so you know what was skipped.

How does it detect whether the body is JSON or form-encoded?

If the request uses --json, or if a Content-Type header contains 'json', the tool treats the body as JSON. If the Content-Type is 'application/x-www-form-urlencoded' or the body looks like key=value pairs joined by '&', it is parsed as form-urlencoded. Everything else is emitted as a raw string body.

Is my curl command sent to any server?

No. Parsing and code generation happen entirely in your browser using JavaScript. Even if your command contains real Authorization headers or API keys, nothing is transmitted.

The generated code doesn't handle files — why?

When curl uses -d @body.json or -F 'file=@upload.png' it reads local files that the browser cannot access. The generator emits a TODO comment where the file should be attached so you can fill it in with your own file object.

Related Tools