HTTP Request to cURL Converter

Runs in browser New Web Utilities

Paste a request as a proxy or a log shows it ("POST /api HTTP/1.1" with its headers and body), the HTTP/2 or General block from your browser's developer tools, or a "Copy as fetch" snippet, and get the matching curl command for a POSIX shell, PowerShell or Windows cmd.exe, with every value quoted for that shell so that nothing in it expands or runs as code. The command is built in your browser and is never sent or run; options remove the cookies or hide Authorization values before you share it.

Privacy: This tool runs entirely in your browser. Your input never leaves your device.
Loading tool…

How do you turn an HTTP request into a curl command that runs safely in your shell?

Map each part of the request to a curl option — the URL, -X for a method curl would not pick itself, -H for each header, --data-raw for the body — and leave out what curl sets on its own, such as Content-Length, Host and hop-by-hop headers. Then quote every value for the shell that will run it: single quotes in a POSIX shell, escaped double quotes for PowerShell and curl.exe, caret escapes in cmd.exe, so that nothing in a header or the body expands or runs as code.

Security note: A request copied from your browser carries your session cookie and tokens: whoever runs the command acts as you. Remove or redact them before pasting a command into a ticket or a chat.

How to use HTTP Request to cURL Converter

  1. Paste the request: from a proxy or a log, from the browser's developer tools (the request's Headers panel, or Copy as fetch), or just a URL.
  2. Choose the shell you will run it in: Bash or zsh, PowerShell or Windows cmd.exe.
  3. Tick Remove the Cookie header and Hide Authorization values if the command will be shared, and add --compressed, -L or -k if you need them.
  4. Copy the curl command, read the Headers table and the notes, then run it in your terminal.

HTTP Request to cURL Converter features

  • Reads a raw HTTP/1.1 request, HTTP/2 pseudo-headers, the developer-tools General and Request Headers blocks, a "Copy as fetch" snippet or a bare URL
  • Writes the curl command for Bash or zsh, for PowerShell (as curl.exe) or for Windows cmd.exe, with each value quoted the way that shell needs
  • Keeps the body byte for byte with --data-raw, so a leading @ is never read as a file name, and forces -X GET only when a GET carries a body
  • Leaves out what curl sets itself or would break the request — Host, Content-Length, Connection, Transfer-Encoding — and lists each with the reason
  • Can remove the Cookie header, hide Authorization values, add --compressed, -L or -k, and write one option per line
  • Notes what changed and why: an assumed https://, -g for a URL with [ ] or { }, a minified JSON body for cmd.exe, response headers left out of a DevTools paste

Inputs and outputs

Inputs

  • HTTP request, DevTools headers or fetch() call — the request as text, up to 2 MB; Input format detects which of them it is, or you choose.
  • Shell and options — Bash or zsh, PowerShell or cmd.exe; one option per line; --compressed, -L and -k; removing the Cookie header; hiding Authorization values.

Outputs

  • curl command — ready to paste into the chosen shell, to copy or download.
  • Request — the method, URL, HTTP version, how the paste was read, the body size in bytes and the shell.
  • Headers — every pasted header and whether it is in the command, left out (with the reason) or included with its value hidden.
  • Notes on the command and Before you run it — what the converter assumed or changed, and what the command contains.

HTTP Request to cURL Converter example

A JSON POST with a token, cookies and an apostrophe in the body

Input:

POST /api/v1/orders?expand=items HTTP/1.1 with Host: shop.example.com, Content-Type and Accept: application/json, Authorization: Bearer …, Cookie: session=demo123; theme=dark, Content-Length: 45, Connection: keep-alive and the body {"sku":"TS-1042","quantity":2,"note":"Ali's"} (the tool's Load example), shell Bash or zsh

Output:

curl 'https://shop.example.com/api/v1/orders?expand=items' \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json' \
  -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJkZW1vIn0.demo-signature' \
  -H 'Cookie: session=demo123; theme=dark' \
  --data-raw '{"sku":"TS-1042","quantity":2,"note":"Ali'\''s"}'
Headers: Host — Left out: curl sets it from the URL · Content-Length — Left out: curl computes it from the body · Connection — Left out: hop-by-hop, curl manages the connection
Notes on the command: No scheme in the request: https assumed.

How to read the HTTP Request to cURL Converter results

"Left out" in the Headers table is deliberate: curl computes Content-Length and Host, manages Connection itself, and sets Accept-Encoding when --compressed is on. Add one back with -H only if you really need a different value.

A note that https was assumed means the paste had no scheme; change the URL in the command to http:// if the service speaks plain HTTP.

The PowerShell note about version 7.3 is not an error: in 7.3 and later PowerShell passes arguments differently, and the command is quoted for the older rules.

A minified-body note for cmd.exe means line breaks were removed between JSON tokens only; every value is kept exactly as written.

When to use HTTP Request to cURL Converter

  • Reproducing a failing request from browser developer tools or a proxy log in a terminal, to share in a bug report.
  • Turning a "Copy as fetch" snippet into a command that runs in CI or on a server without a browser.
  • Moving a request between operating systems: the same request quoted for Bash, PowerShell and cmd.exe.
  • Preparing a shareable command with cookies removed and Authorization values hidden.

Troubleshooting

  • "No request line found": the paste starts with something other than METHOD /path, :method: or Request URL:. Copy the request from its first line, or choose fetch() call if it is a fetch snippet.
  • "No host found": the request line has only a path and there is no Host header. Add Host: followed by the server name, or paste an absolute URL in the request line.
  • A fetch() snippet is refused: the options use variables, functions, FormData or a template string. Paste the raw request from the developer tools' Headers panel instead.
  • The command fails in PowerShell 7.3 or later with quoting errors: run $PSNativeCommandArgumentPassing = "Legacy" first, or use the Bash form in WSL or Git Bash.

Frequently asked questions about HTTP Request to cURL Converter

Which input formats are understood?

A raw HTTP/1.1 request (request line, headers, a blank line and the body), an absolute-form request line, HTTP/2 pseudo-headers (:method, :path, :authority, :scheme), the developer-tools General block followed by the request headers (response headers are skipped), a fetch(url, { … }) call whose options are literals, and a bare URL, which becomes a GET.

Why does the PowerShell command call curl.exe?

In Windows PowerShell 5.1 the word curl is an alias of Invoke-WebRequest, which takes different options, so the command names curl.exe. Its quoting is written for Windows PowerShell 5.1 and PowerShell 7.0 to 7.2; in 7.3 and later set $PSNativeCommandArgumentPassing = "Legacy" first, as the result notes.

Is it safe to paste a request that carries my token or cookies?

The conversion happens in your browser and nothing is sent. The command itself, though, contains every header you pasted, so anyone who runs it acts as you. Tick Remove the Cookie header and Hide Authorization values before sharing it.

Why are some headers missing from the command?

curl sets some itself or they would break the request: Content-Length (computed from the body), Host when it equals the URL's host, hop-by-hop headers such as Connection and Transfer-Encoding, Accept-Encoding when --compressed is on, and names that are not valid header tokens. The Headers table lists each one with the reason.

Why does the cmd.exe version look so different?

cmd.exe has no backslash escape, expands %NAME% even inside quotes and cannot pass a line break inside an argument. Special characters are therefore escaped with ^, each % is neutralised, a multi-line JSON body is minified to one line without changing its values, and other bodies lose their line breaks, with a note.

Technical notes

An HTTP/1.1 request is a request line, header fields, an empty line and the body (RFC 9112); the target may be a path, with the host in the Host header, or an absolute URL. HTTP/2 carries the same parts as the :method, :scheme, :authority and :path pseudo-headers (RFC 9113 §8.3), which is what browsers show for HTTP/2 requests. Without a scheme the converter assumes https and says so.

POSIX shells (IEEE Std 1003.1, Shell Command Language §2.2) keep everything inside single quotes literal, so a single quote is written as '\'' — close, escaped quote, reopen. PowerShell expands $ and the backtick inside double quotes, so both are escaped, and curl.exe then parses the argument by the Microsoft C runtime rules, which is why quotes become \`". cmd.exe has no escape inside quotes and expands %NAME% everywhere, so special characters are escaped with ^ and every % is neutralised.

curl sends --data-raw as the request body exactly, sets Content-Length itself, switches to POST when a body is present (so a GET with a body needs -X GET), and answers -I with a HEAD request. Headers whose name is not an RFC 9110 token, and hop-by-hop headers such as Connection and Transfer-Encoding, are left out because curl manages the connection itself. curl also reads [ ] and { } in a URL as ranges and lists (its URL globbing), so the converter adds -g (--globoff) whenever the URL contains them and the URL is sent as written.

Limitations and methodology

The converter never sends the request: whether the command works depends on the server, your network and anything the paste did not include, such as cookies set by JavaScript or a session that has expired.

Multipart form uploads, binary bodies and files are not rebuilt as -F or @file options; the body is passed as text with --data-raw.

fetch() snippets are read only when their URL and options are literals; variables, FormData and template strings cannot be evaluated.

cmd.exe cannot pass line breaks inside an argument and handles non-ASCII text through the console code page, so bodies with line breaks are flattened and non-ASCII text may need chcp 65001.

Security and privacy

The conversion runs in your browser: the request, its tokens and its cookies are never sent or stored. The command you copy contains them unless you remove them, so treat it like a password.

References

  • curl(1) — Linux manual pageman7.org (curl project manual)Every curl option: -X, -H, --data-raw and --data-binary, -I, -L, -k and --compressed, and how curl picks the method from the options.
  • Shell Command Language (IEEE Std 1003.1-2024)The Open Group · 2024The POSIX shell grammar, including §2.2 Quoting: why everything inside single quotes is literal and how a single quote itself is written.
  • RFC 9112: HTTP/1.1IETF · 2022The HTTP/1.1 message syntax: request line, header fields, chunked transfer and connection handling.