cURL to Code: Python, JavaScript, Go, PHP & Java

Paste any cURL command and get the same request in Python, JavaScript, Node.js, Go, PHP or Java. Headers, JSON and form bodies, file uploads, basic auth, cookies and timeouts are all carried over — including Chrome’s “Copy as cURL” for both bash and Windows.

AI DevRuns in your browser — nothing uploaded

Output language

Converted in your browser — tokens and passwords in the command never leave your device. Tip: in Chrome DevTools, right-click a request in the Network tab → Copy → Copy as cURL.

How it works

  1. 1

    Reads the command like a shell

    Single and double quotes, $'…' strings, backslash line breaks and Windows ^ escapes are all understood — so Chrome’s “Copy as cURL (bash)” and “(cmd)” both work.

  2. 2

    Understands curl’s options

    -X, -H, -d, --data-raw, --data-urlencode, --json, -F, -u, -b, -G, -k, -L, -x, --max-time and more — with curl’s own defaults, like POST when there’s a body.

  3. 3

    Writes idiomatic code

    json= in Python, URLSearchParams and FormData in JavaScript, a multipart writer in Go, CURLFile in PHP and a text block in Java — the way each language would normally do it, using only what ships with it where possible.

  4. 4

    Tested against real curl

    Code in all seven languages was run against a test server and checked to send the same method, URL, headers and body as curl itself.

Questions, answered

Python (requests), JavaScript fetch for the browser, Node.js, axios, Go (net/http), PHP (the built-in cURL functions) and Java (the HttpClient built into Java 11 and later). Go, PHP and Java code uses only the standard library.

Popular uses

Read the guide