The quick answer

Copy a request as cURL from DevTools, paste it here, and get working code in three targets, JavaScript fetch, Python requests, and Node axios, with headers, JSON bodies and -u auth mapped per language. Everything parses in your browser, so live tokens never upload.

You copied it as cURL. Now you need it in Python.

It starts in the Network tab. The endpoint is misbehaving, you right-click, 'Copy as cURL,' paste it into a terminal, and it works: status 200, body intact, mystery 500 nowhere in sight. Now you know the request is fine and the bug is in your code. The natural next move is to turn that working request into your language, and the natural way to do that is to start typing headers one at a time like it's 2013.

The curl Converter above exists for exactly this moment. Paste the command, get working code in JavaScript fetch, Python requests, and Node axios, with headers, bodies and auth mapped to each language's idiom. It runs in your browser, which matters here more than on almost any other tool on this site: copied curl commands contain live credentials, and the architecture guarantees the command you paste is never transmitted anywhere.

From pasted command to working code

The path from clipboard to code is short and always the same shape: paste, read the parse, read the code, copy. The steps exist because the parse view is where wrong assumptions get caught:

  1. Paste the curl command

    Straight from DevTools 'Copy as cURL,' from documentation, or from a teammate's message. Multi-line commands with backslash continuations are handled; the parser rejoins them before reading flags.

  2. Watch it parse live

    Four stat cards show what it understood: the method, the header count, whether a body is present, and the URL. This intermediate view is your chance to catch shell variables and placeholders before they fossilize into generated code.

  3. Compare the target languages

    fetch, Python requests, and Node axios render together from the same parse, with no tabs and no switching. Each block has its own Copy button, and comparing dialects of the same request is a glance.

  4. Review the generated code

    Bodies convert to language-native forms: -d JSON becomes a JSON.stringify() body in fetch and a json= parameter in requests, which sets its own Content-Type. A -u user:pass flag becomes an Authorization: Basic header in all three targets.

  5. Copy and adapt

    Copy the snippet into your project. The converter's job is a correct starting point; parameterize the URL and pull secrets into environment variables before this code reaches a repository.

What the parser reads, flag by flag

Converting curl correctly means implementing the parts of its command language that appear in real usage. The parser treats a curl command as a URL plus a stream of flags, and each flag has a defined translation:

curl flagMeaningBecomes in generated code
-X POSTExplicit methodmethod: 'POST' / requests.post(...)
-H 'K: V'Header (repeatable)headers object / dict entries
-d '{...}' (also --data-raw, --data-binary)Request body (implies POST)body / json= parameter
-u user:passBasic authAuthorization: Basic header in all three targets
-A 'UA'User-AgentUser-Agent header entry
-L, -s, -k, -iRedirects, silence, skip-TLS, include headersIgnored: no fetch/requests equivalent worth emitting
-b, -G, --compressed and friendsCookies, query moves, encodingsSkipped: unknown flags never break the parse; re-add what your endpoint needs by hand
The flags that cover the overwhelming majority of copied commands, and what each becomes, or doesn't, in the generated code.

Two parsing details do most of the quiet work. First, shell quoting: single- and double-quoted strings are both read as literal content, quotes stripped, and the browser never expands $variables in either. That's also why commands copied from docs with $PLACEHOLDER variables don't fully convert: the browser never knew what the shell substituted, and the placeholder survives as literal text. Second, flag implications: curl switches its default method to POST whenever a body is supplied, and the converter encodes those implicit behaviors explicitly, because generated code should never rely on defaults the target library doesn't share. Headers arriving as repeated -H flags become a headers object in fetch and a dict in requests; if the same header appears twice, the last value wins, the one place naive-looking output needs an eye before you trust it.

One command, three languages

Here is the full pipeline on a realistic command, the shape of request that API debugging actually produces. Same command, all three of the tool's targets:

curl 'https://api.example.com/v1/orders' \
  -X POST \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9' \
  -H 'Idempotency-Key: 8f14e45f-ea36-4f5b-b0d1-ccf7f4b9e6b0' \
  -d '{"sku": "TS-42", "qty": 3, "note": "gift wrap"}'
// JavaScript fetch (browser or Node 18+)
const response = await fetch('https://api.example.com/v1/orders', {
  method: 'POST',
  headers: {
      "Content-Type": "application/json",
      "Authorization": "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9",
      "Idempotency-Key": "8f14e45f-ea36-4f5b-b0d1-ccf7f4b9e6b0"
  },
  body: JSON.stringify({"sku": "TS-42", "qty": 3, "note": "gift wrap"}),
});
const data = await response.json();
console.log(data);
# Python requests
import requests

response = requests.post(
    'https://api.example.com/v1/orders',
    headers={"Content-Type": "application/json", "Authorization": "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9", "Idempotency-Key": "8f14e45f-ea36-4f5b-b0d1-ccf7f4b9e6b0"},
    json={"sku": "TS-42", "qty": 3, "note": "gift wrap"},
)
print(response.json())

Note the structural choices, because they are where converters earn their keep. The raw JSON string in -d became a parsed object passed through json= in Python; requests sets Content-Type itself and handles encoding, so the header entry becomes redundant (the converter keeps your explicit header, since your command asserted it). The same string became JSON.stringify() over an object literal in fetch, because the body must be a string on the wire but nobody should hand-write escaped JSON.

// Node 18+ has global fetch; the browser snippet works as-is.
// For axios instead:
const axios = require('axios');
const { data } = await axios({
  method: 'post',
  url: 'https://api.example.com/v1/orders',
  headers: {"Content-Type": "application/json", "Authorization": "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9", "Idempotency-Key": "8f14e45f-ea36-4f5b-b0d1-ccf7f4b9e6b0"},
  data: {"sku": "TS-42", "qty": 3, "note": "gift wrap"},
});
console.log(data);

One idiom the three blocks surface together: fetch and axios both hand you a promise, while requests returns the response synchronously; the destructured const { data } in the axios block is the fetch block's await response.json(), spelled differently. Node 18+ ships global fetch, so the first snippet runs unchanged there, and the axios form exists for codebases already committed to it.

A 500, chased from Network tab to regression test

The scenario every backend developer eventually lives: the staging orders endpoint returns 500, but only from the production client. The server log shows a JSON decode error and nothing else. The debugging sequence that resolves it in ten minutes runs straight through this tool.

Step one is the Network tab: reproduce the failure from the browser, right-click the request, Copy as cURL, paste into a terminal, run. It returns 200. That single run halves the problem, because the endpoint, the auth, and the payload are all fine, and the difference must live in what the client actually puts on the wire.

curl 'https://api.staging.example.com/v1/orders' \
  -X POST \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9' \
  -d '{"sku": "TS-42", "qty": 3}'

Step two is the conversion: paste the command, read the Python block, and set it beside the client code. The difference turns out to be one parameter long:

# The failing client: 500 in staging
import requests

resp = requests.post(
    "https://api.staging.example.com/v1/orders",
    headers={"Authorization": "Bearer eyJ...",
             "Content-Type": "application/json"},
    data={"sku": "TS-42", "qty": 3},   # form-encoded, mislabeled
)
print(resp.status_code)  # 500
# The converted, working version
import requests

response = requests.post(
    "https://api.staging.example.com/v1/orders",
    headers={"Content-Type": "application/json", "Authorization": "Bearer eyJ..."},
    json={"sku": "TS-42", "qty": 3},
)
print(response.status_code)  # 200

Step three freezes the fix so it cannot regress: the converted call wrapped in the test the ticket deserved from the start:

import requests

def test_orders_accepts_json_body(staging_base, token):
    resp = requests.post(
        f"{staging_base}/v1/orders",
        headers={"Authorization": f"Bearer {token}"},
        json={"sku": "TS-42", "qty": 3},
    )
    assert resp.status_code == 200
    assert "id" in resp.json()

The whole loop, copy, run, convert, diff, test, takes about ten minutes, and the conversion step is what turns a hunch into a diff. Without it the investigation is 'maybe the body is wrong somewhere'; with it, the failing line and the working line sit next to each other, one parameter apart.

What doesn't survive translation

A converter that claims total fidelity is lying, so here is the honest list of what stays behind:

  • -F multipart uploads. The parser skips -F, and local file paths wouldn't translate anyway. Rebuild multipart requests by hand with requests' files= parameter or a FormData object, and reattach the files yourself.
  • Non-HTTP protocols. curl speaks FTP, SMTP, TELNET, and more; fetch and requests largely don't. Those commands are out of scope by nature.
  • Retry, timing, and tracing flags. --retry, --connect-timeout, --trace have per-library equivalents that differ enough that auto-emitting them would mislead more than help. Add them deliberately in the target language.
  • Proxy and interface flags. --proxy and --interface are infrastructure decisions, not request properties; they belong in the target's session or environment configuration.
  • Shell context. Anything a shell did before curl ran, variable expansion, command substitution inside the URL, pipes, never existed as far as the copied command's text is concerned. Convert the resolved command, not the template.
  • Browser-only constraints, positively stated. Converted fetch code is faithful but the browser may refuse to send it: CORS preflights, credentials-mode rules, and forbidden headers (User-Agent is settable in curl, not in browser fetch). Node runs the same code without those rules. Knowing which environment you're targeting is part of the conversion.

Header folklore the parser quietly respects

HTTP details that trip up experienced developers anyway, and how each one is handled on the way from command to code:

  • Header case is defined as insensitive and most servers honor it, but HTTP/2 lowercases every header on the wire, and the rare backend that matches case-sensitively works over HTTP/1.1 and breaks over h2. The generated code keeps your header names exactly as you pasted them, which is correct and occasionally diagnostic.
  • Duplicate headers are legal, and Set-Cookie cannot be safely merged into one comma-joined line. The generated headers object keeps the last value when a header repeats; if your command sets one twice, make the duplicate deliberate before it quietly disappears.
  • User-Agent is trivially set by curl and requests, settable in Node, and forbidden in browser fetch, one more reason identical converted code behaves differently across runtimes and a frequent answer to 'works in Node, fails in the browser.'
  • Whitespace at the edges of a copied JSON body is invisible in a terminal and hostile to strict parsers downstream. Bodies convert as pasted, so when converted code suddenly works where the original curl failed, a trailing newline at the terminal's edge is the usual suspect.

The headers Chrome adds when you copy, and which ones your code needs

A 'Copy as cURL' from DevTools arrives carrying the browser's whole negotiation stack: accept headers, client hints, fetch metadata, cookies, origin context. Most of it is atmosphere; a little of it is load-bearing. The census, with a verdict for each row:

Header in the copied commandWhat it tells the serverKeep it in converted code?
Authorization / CookieYour actual identityAlways: moved into environment variables, never into source
Content-TypeThe body's formatAlways, or let the library's json= mode set it
AcceptWhich response representation you understandKeep when the API varies output by Accept; drop otherwise
Accept-EncodingWhich compression you supportDrop: every HTTP library negotiates this itself
Accept-LanguagePreferred response localeKeep only when testing localized behavior
Origin / RefererWhere the request appears to come fromKeep when the endpoint validates them; some APIs and CSRF defenses do
Sec-Fetch-Site / Mode / Dest / UserFetch metadata from the browser contextDrop for scripts; keep when replaying requests a gated endpoint expects
Sec-CH-UA familyClient hints describing the browserDrop: bot defenses read them, application servers ignore them
User-AgentThe client's self-descriptionKeep, and see below: the default library UA gets blocked
One request, sixteen headers, three that usually matter. The generated code carries them all; this table decides what survives.

The User-Agent verdict deserves its own paragraph, because it is the most common reason converted code fails where curl succeeded. curl identifies itself as curl/8.x and requests as python-requests/2.x, and some APIs treat the library's default string as grounds for a 403 on sight; pasting the copied command's exact User-Agent into the converted headers usually makes the failure vanish. Some bot defenses fingerprint deeper than headers, right down to the TLS handshake, and no header fixes those: the curl command itself becomes the reliable client, worth knowing before an afternoon is spent blaming the converter.

A stripping discipline that scales: keep the headers the server would refuse you without (auth, cookies, content type), keep the headers the server changes behavior for (accept variants, origin on gated endpoints), drop the headers that describe a browser context your script is not. Start from the three-row version, add headers back one at a time when a request fails, and the converted snippet stays honest about what it actually needs rather than wearing the browser's entire wardrobe.

Who pastes curl commands all day

The populations are distinct enough to be worth naming.

Backend and API developers are the core: they debug in DevTools, confirm with curl, and then need the working request as Python or Node in a test suite. Data scientists hit public APIs from notebooks and want the endpoint they just tested as a requests snippet without hand-translating headers; the Python block was built with them in mind.

QA and automation engineers convert captured requests into regression tests, often a dozen at a time. Frontend developers use the fetch and axios blocks to prototype calls against staging, then hit CORS and learn the Node/browser distinction the hard way, once, forever. Integration engineers and SREs round it out with webhook payloads to replay and incident-time requests to reproduce in a script. And students convert documentation examples into their course language, which is quietly the best way to learn what an HTTP request actually consists of: seeing one request as three dialects at once teaches the request/response model faster than any diagram.

Four ways to convert, compared

ApproachBest atCost
Hand transcriptionLearning the request structure onceSlow; typo-prone; every new command pays again
curlconverter.comThorough single-command conversion, many targetsOne command per visit; heavyweight page for quick iterations
Postman importFull API exploration workflowA whole application between you and the code; account-centric
This converterAll three targets at once, per-block copy buttons, credential-safe by architectureNot an API workbench: a fast, faithful translator
Different tools for different relationships to the problem.

The niche this tool occupies is the clipboard-shaped one: you have a command, you need code, and everything between those two states should be one paste and one click. Workbench tools are excellent at what they do and the wrong shape for this moment, the way a table saw is wrong for hanging a picture. What this converter is built for is the round trip: paste, read the parse, read the blocks, copy, done, with no account, no saved workspace, and no network request carrying your bearer token to anyone.

Your terminal history stays yours

Everything, the flag parsing, the body decoding, all three language emitters, runs in your browser. The command you paste, including its authorization headers, cookies, and API keys, is processed on your device and transmitted nowhere. There is no conversion history, no 'recent commands' panel, and no account, because there is no server holding commands at all.

For this tool that architecture is not a nice-to-have; it is the only acceptable design. DevTools 'Copy as cURL' captures live session credentials, that is literally its job. A converter that posts those commands to a backend for processing is a credential relay with a UI. The client-side design also means the tool works when you're offline, air-gapped, or on a locked-down corporate network, which describes a real fraction of the moments people need to convert a request.

Frequently asked questions

These are the questions that surface the moment a converted snippet misbehaves: quoting, $ variables, 403s, and whether the tokens in your clipboard were ever sent anywhere. If yours is missing, the contact page takes new questions.

Does -d in curl automatically mean POST?

Yes. Adding -d/--data switches curl's default method to POST even without -X POST, and sets a form-style Content-Type unless you override it. That's why the converter emits an explicit POST with a body object in the generated code; it's encoding curl's implicit behavior into code that has no such defaults.

My copied command has $ variables in it. Why won't it convert?

Because $API_KEY was a shell variable, and your browser has no idea what it held. DevTools 'Copy as cURL' sometimes includes shell-escaped values, and commands copied from documentation often contain placeholders. Paste the command with the real values substituted, or edit the $ placeholders in the input box before converting; the parser treats them as literal text otherwise.

Why does the fetch version work in Node but fail in my browser?

CORS. The fetch call is faithful to your curl command, but browsers enforce cross-origin rules that curl ignores: no preflight, no credential restrictions, nothing. A server that happily talks to curl from your terminal can still refuse a browser request from a different origin. Test converted fetch code in Node first; if it works there and fails in the browser, the difference is CORS policy, not the conversion.

Does the converter handle multipart file uploads (-F)?

No. -F is one of the flags the parser skips, so multipart commands don't convert meaningfully, and local file paths wouldn't translate anyway, since your Python or JavaScript has no access to a file that existed on the machine where the curl command ran. Rebuild the request by hand with requests' files= parameter or a FormData object, reattaching the files yourself.

Are my cookies and auth headers sent to your server?

No. Parsing and code generation happen entirely in your browser. Commands containing bearer tokens, session cookies, and API keys never leave the page; there is no upload, no history, no logging. This matters more than usual for this tool, because pasted curl commands frequently contain live credentials.

What happens to flags like -k and -L when I convert?

They are ignored. -k (skip TLS verification) and -L (follow redirects) have no emitted equivalent; the generated code verifies certificates and follows redirects the way fetch and requests do by default. If you genuinely need curl's -k behavior, add verify=False by hand and loudly, because disabling certificate verification makes your code vulnerable to interception in transit. -k is fine for debugging a broken cert on a test box and indefensible anywhere else.

Which target languages does the converter support?

Three: JavaScript fetch (browser and Node 18+), Python with the requests library, and Node with axios. All three blocks render together from the same parsed command; the parse is identical, only the emitter changes, so comparing dialects of the same request is instant.

Why do my curl commands use single quotes around the JSON body?

Because of the shell. Double quotes let the shell expand $variables and backticks inside your JSON, which corrupts bodies containing dollar signs. Single quotes pass the string through untouched. When converting, paste the command as you would actually run it; the parser understands both quoting styles.

Is it safe to paste curl commands containing live tokens?

Into this tool, yes: parsing and code generation are local, and the command never leaves your browser. The risk sits elsewhere. Shell history records every command you run, and -H with a literal token or -u with a password lands there in plain text. Prefer environment variables on the command line (-H "Authorization: Bearer $TOKEN"), and replace literals with env lookups in converted code before anything reaches a repository.

What is the difference between -d and --data-urlencode?

-d sends the string as-is: the bytes you type are the bytes on the wire, so fields containing spaces or ampersands arrive malformed unless you encode them yourself. --data-urlencode encodes the field properly before sending. The converter maps -d bodies straight through and skips --data-urlencode, so re-encode those fields by hand; in requests, pass a list of tuples to data= and let the library do the encoding.

Can the converter generate PowerShell instead?

Not currently; the targets are fetch, Python requests, and Node axios. The manual mapping is short enough to do by eye: Invoke-RestMethod -Uri with -Method, a -Headers hashtable for the header entries, -Body with the JSON string and -ContentType 'application/json', and curl's -u flag becoming -Authentication Basic with -Credential. PowerShell's curl alias for Invoke-WebRequest is also worth remembering: on Windows, the command named curl is frequently not curl at all.

Why does my converted code return 403 when the curl command worked?

Almost always the User-Agent. Scripts and libraries announce themselves with strings like python-requests/2.x, and plenty of APIs, CDNs, and bot defenses block those on sight while admitting curl/8.x. Copy the exact User-Agent from the working command into the converted headers first. If the 403 survives a real browser UA, the defense is fingerprinting the TLS handshake itself; at that point the curl command is the only client that gets through, and the converted code needs a different route or an approved token.

Docs worth keeping open

Convert the request, decode the token, dissect the URL, extract the response field; the JWT decoder, URL parser and JSONPath tester complete that debugging loop, all of it local. The flags this parser implements are documented at the source, and the target libraries have canonical references of their own:

Sources and further reading

We cite primary sources (standards bodies, government agencies, official documentation) wherever they exist so you can verify every number on this page yourself.