Guide
Turning a curl command into fetch, Axios or Python code
curl is the lingua franca of HTTP: API documentation shows examples as curl commands, and every browser can copy a request from its network panel as curl. Turning one of those commands into application code means translating flags into headers, bodies and options by hand. This converter parses the command and writes the equivalent JavaScript or Python.
Getting a command to convert
In Chrome, Edge or Firefox developer tools, open the Network tab, right-click a request and choose Copy as cURL (bash). On Windows there is also a cmd version; both are understood. API documentation from Stripe, GitHub, OpenAI and most others includes ready-made curl examples too.
How the command is read
The command line is split the way a shell would split it. Single quotes keep text literally, double quotes allow escaped quotes inside, $'…' strings understand \n, and line continuations — backslash in bash, caret in cmd, backtick in PowerShell — are joined. Then each option is interpreted: -X sets the method, -H adds a header, -d and its variants supply a body, --json supplies a JSON body with the right headers, -F builds a multipart form, -u adds basic authentication, -G moves data into the query string, -L follows redirects and -k skips certificate checks. Options that have no equivalent are listed as warnings rather than silently dropped.
Methods and content types
curl infers things a library does not. With data and no -X, the method is POST; with -I, it is HEAD. With -d and no content type, curl sends application/x-www-form-urlencoded, so the converter adds that header explicitly. The summary panel shows the method, URL, headers, body size and options the converter understood, so you can check the interpretation.
The generated code
For fetch, headers become an object, a JSON body becomes JSON.stringify of a readable object literal, and the response is read with .json() when the request expects JSON. Axios gets one configuration object, and the Node.js variant uses Node’s built-in fetch. For Python, requests and httpx receive headers=, json= for JSON bodies (without a duplicate Content-Type header), data= and files= for forms, auth=(user, password) for -u, a 30-second timeout and raise_for_status(), so errors are not silently ignored.
A worked example
The sample posts an order to an API with a bearer token and a JSON body. In fetch it becomes await fetch("https://api.example.com/v1/orders?notify=true", { method: "POST", headers: {…}, body: JSON.stringify({ customer_id: 42, … }) }). In Python it ends with response = requests.post('https://api.example.com/v1/orders?notify=true', headers=headers, json=payload, timeout=30), then response.raise_for_status() and print(response.json()).
Security notes
Commands copied from a browser contain your cookies and tokens. The conversion happens entirely in your browser and nothing is sent anywhere, but the secrets are copied into the generated code, so remove or replace them before committing or sharing it. If the command used -k, the code also disables certificate checks; never keep that in production.
Forms and file uploads
A -F '[email protected]' field means “upload this file”. Browsers cannot read files from a path, so the fetch output builds a FormData and marks where to append a file from an input element; the Python output opens the file with open(…, 'rb') and passes it in files=. Plain -F name=value fields are copied as text fields.
Related tools
Generate Go, Rust, PHP, Ruby, C# or Java with cURL to Code, create types for the response with JSON to TypeScript, read the response in the JSON Formatter, or encode query parameters with the URL Encoder.
Checked against the current version of the cURL to Fetch, Axios & Python on .

