cURL converter
Updated Free mock REST & WebSocket APIs
Paste a curl command — for example from Chrome DevTools' “Copy as cURL” or an API's docs — and get equivalent code in JavaScript fetch, Axios, Python requests or Go. Everything runs in your browser.
POST https://mockfox.dev/api/fake/posts2 headersbody 52 chars
const response = await fetch("https://mockfox.dev/api/fake/posts", {
method: "POST",
headers: {
"Content-Type": "application/json",
Authorization: "Bearer YOUR_TOKEN",
},
body: JSON.stringify({
"title": "Hello",
"body": "From curl",
"userId": 1
}),
});
const data = await response.json();🔒 Converted in your browser — your command, tokens and URLs are never sent anywhere.
How to convert a curl command
- Paste the command into the box (multi-line commands with
\continuations are fine) — or copy one from DevTools with Copy as cURL. - Pick the output language. The code updates as you type.
- Copy or download the code, and check any warnings about options that can't be converted.
Supported curl options
| Option | Converted to |
|---|---|
-X, --request | HTTP method |
-H, --header | Request headers (an empty value removes one) |
-d, --data, --data-raw, --data-binary | Body; implies POST and form encoding |
--data-urlencode | URL-encoded body fields |
--json | JSON body + Content-Type and Accept |
-F, --form | multipart/form-data (files and fields) |
-u, --user | Basic authentication |
-b, --cookie | Cookie header |
-A, -e | User-Agent, Referer |
-G, --get | Data moved into the query string |
-I, --head | HEAD request |
-L, -k, --compressed | Redirects, TLS verification, compression |
Output-only flags such as -s, -v, -i and -o don't change the request and are ignored. Options that read files (-d @file) produce a placeholder and a warning.
Gotchas when translating curl
- curl doesn't follow redirects unless you pass
-L, but fetch, Axios (in browsers), requests and Go do. The converter disables redirects where the library allows it. -dsendsapplication/x-www-form-urlencodedby default, even if the data looks like JSON. Add-H 'Content-Type: application/json'or use--json.- Browsers ignore some headers set from JavaScript (
Cookie,User-Agent,Host,Refererare forbidden or overridden), and cross-origin calls need CORS.
Need an endpoint to try your code against? Use the free fake REST API or test any HTTP status code.
Related tools
Frequently asked questions
Is my curl command sent to a server?
No. The converter runs entirely in your browser, so API keys, tokens and URLs in your command never leave your device.
How do I copy a request as cURL?
In Chrome, Edge or Firefox DevTools, open the Network tab, right-click a request and choose Copy → Copy as cURL (bash). Paste it here to turn it into code.
Does it support Windows cmd curl commands?
Yes for most commands: ^ line continuations and double-quoted arguments are handled. PowerShell's curl alias (Invoke-WebRequest) uses different syntax and isn't supported.
Which languages can it generate?
JavaScript fetch, Axios (JavaScript/TypeScript), Python with requests, and Go with net/http.
Your business here? Sponsor this tool from $16/week. See placements