chain
cURL Converter
CURL COMMAND
// about this tool

cURL Converter Online

Updated 2026-08-02

Convert a cURL command into working code — JavaScript fetch, Python requests, PHP Guzzle, Go net/http, or HTTPie. Paste anything from a README snippet to a full browser "Copy as cURL" and the method, headers, JSON or form body and auth all carry across.

The command is parsed, never executed. It is tokenised the way a shell splits arguments — handling single quotes, double-quoted escapes and backslash line continuations — and that is the whole of it: no shell, no subprocess, no eval. Everything runs in your browser, and because a copied browser request usually carries a live session token, the tool tells you when it spots one before you paste the result somewhere public. Flags with no snippet equivalent, like -k or -L, are surfaced as notes rather than quietly dropped.

// how to use

  1. 1 Paste a cURL command — including one copied straight from your browser's network tab with "Copy as cURL".
  2. 2 Pick a language from the tabs above the output.
  3. 3 Copy the generated code. Method, headers, body and form fields all carry across.

// examples

A browser Copy-as-cURL, converted to fetch
Input
curl 'https://api.example.com/v1/users' -X POST \
  -H 'Content-Type: application/json' \
  --data-raw '{"name":"Ada","active":true}'
Output
const response = await fetch('https://api.example.com/v1/users', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    "name": "Ada",
    "active": true
  }),
});
The same command as Python
Input
target: python
Output
import requests

headers = {
    'Content-Type': 'application/json',
}

json_data = {
    'name': 'Ada',
    'active': True,
}

response = requests.post('https://api.example.com/v1/users', headers=headers, json=json_data)
print(response.json())
Flags with no code equivalent become notes
Input
curl -u admin:s3cret -k https://example.com
Output
Authorization header added as a placeholder — base64-encode the credentials yourself.
TLS verification was disabled (-k). The generated code keeps verification ON.

// common uses

Turning a browser network-tab request into working code Moving a documented API example into the language you actually use Getting a Python or Go starting point from a curl snippet in someone's README Reading exactly what headers and body a long cURL command is really sending

// faq

Is the command executed?
No. It is tokenised the way a shell would split it — quotes, escapes and backslash line continuations — and nothing more. There is no shell, no subprocess and no eval anywhere in this tool. It reads the command; it never runs it.
Which languages can it output?
JavaScript (fetch), Python (requests), PHP (Guzzle), Go (net/http) and HTTPie. Switching tabs re-generates from the same parsed request, so every tab is a faithful translation of the same command rather than a separate parse.
What happens to my auth token if I paste a real request?
Nothing leaves your browser — the conversion runs locally. The tool also checks for what looks like a credential and warns you before you copy, because a browser "Copy as cURL" usually carries a live session cookie or bearer token, and those get pasted into tickets by accident all the time.
Why does a file upload come out as plain text?
Because -F 'file=@photo.png' tells cURL to read that file from disk, and a code snippet cannot do that for you. The tool flags it and points at the right call for your language — open() in Python, fs.createReadStream in Node — rather than silently generating code that uploads the nine characters "@photo.png".
Does it work with Chrome's "Copy as cURL"?
Yes, both variants. The bash version uses ANSI-C quoting ($'...') whenever a header contains a newline or a quote, which is most of the time for cookies — a tokeniser that misses it produces a header literally named $Cookie. The Windows version uses ^ for line continuations instead of a backslash. Both are handled.
What about -G, --json, or credentials in the URL?
All handled the way cURL actually behaves. -G moves your data onto the query string rather than sending a body. --json (curl 7.82+) expands into a body plus Content-Type and Accept headers, while an explicit -H still wins. A URL like https://user:pass@host is split, with the credentials moved into an Authorization header, because cURL strips them too.
Which cURL flags are understood?
Method (-X), headers (-H), body (-d, --data-raw, --data-binary, --data-urlencode), forms (-F), basic auth (-u), cookies (-b), user agent (-A), referer (-e) and --url. Flags that only change transport behaviour — -L, -k, --compressed, timeouts, proxies — are reported as notes instead, since the target clients handle those differently or by default.

Use this via API

Get a free API key →
curl -X POST https://thesnaptools.com/api/v1/tools/curl-converter \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"command":"curl 'https://api.example.com/v1/users' -X POST \\ -H 'Content-Type: applicati..."}'
Esc
↑↓ navigate open Esc close