1. Home
  2. Developer tools
  3. cURL to Fetch, Axios & Python

cURL to Fetch, Axios & Python

Copy a request as cURL from browser DevTools or API documentation and get working JavaScript or Python in one step.

Free, no sign-up. Runs in your browser: nothing is uploaded.

How to use cURL to Fetch, Axios & Python

  1. Paste the curl command.
  2. Choose fetch, Axios, Node.js, requests or httpx.
  3. Copy the code.

Features

  • Shell quoting, line continuations and $’…’ strings parsed correctly
  • -X, -H, -d, --data-raw, --json, -F, -u, -G, -L, -k and more
  • JSON bodies become objects; Python uses json=
  • Basic auth, cookies, user agent and referer
  • Warnings for options that are not translated

Supported formats

Input

  • cURL command

You get

  • JS
  • PY
  • Copied text

Private by design

Everything you enter is processed by your browser on this device. Nothing is sent to openWorkstand or anyone else, so the cURL to Fetch, Axios & Python is safe for private and work data. After you have used it once while online, it also works without an internet connection. How local processing works

Good to know

  • Rare curl options (proxies, client certificates, retries) are reported but not translated.

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.

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 .

Frequently asked questions

Why does my browser-copied command have so many headers?

Copy as cURL includes everything the browser sent: cookies, sec-ch-ua hints, accept-language and more. Most are not needed to reproduce the request. Delete them from the generated code and keep authorization, content type and anything the API documents.

Will the fetch code work in the browser?

Only if the API allows it. Browsers enforce CORS, so a request that works from curl may be blocked from a web page on another origin. The same code runs without CORS restrictions in Node.js, Deno or a server-side route.

What is the difference between requests and httpx?

Both have almost the same API. httpx also supports async and HTTP/2, and it does not follow redirects unless asked, which is why the httpx output adds follow_redirects=True when the curl command used -L.

How do I get a request as cURL?

In Chrome or Edge DevTools, open the Network tab, right-click the request and choose Copy → Copy as cURL (bash). Firefox has the same under Copy Value → Copy as cURL. Paste it here.

Are my tokens safe?

The command is parsed in your browser and nothing is sent anywhere. Still, remove real tokens before sharing the generated code, since they are copied into it.

Keep working with the result

openWorkstand also includes a free workspace with documents, spreadsheets, tasks, projects and a calendar that save to a folder on your computer.