Input
Preparing your workspace…
How to use
- Paste a Fetch call containing supported literal request data.
- Supply Base URL for a relative URL and review any compatibility notes.
- Copy the generated command or download request.sh.
Extracting a request from Fetch code
A Fetch snippet can contain both request data and arbitrary application logic. This converter reads a restricted syntax tree so request data can be translated without running the snippet.
A generated cURL command lives outside the browser context. Cookies, same-origin policies and other environment settings therefore need to be considered separately.
Literal syntax and dynamic values
Supported forms include literal strings, arrays and objects, JSON.stringify, and literal Headers or URLSearchParams constructors. An awaited call, one variable declaration or a response-handler chain can surround the request.
Values supplied by variables, functions, imports or other dynamic expressions are not evaluated. Binary and multipart bodies are outside the supported conversion workflow.
fetch("https://httpbin.org/anything?source=devtoolsy", {
method: "POST",
headers: {"Content-Type": "application/json"},
body: JSON.stringify({message: "Hello, API!", active: true}),
credentials: "omit"
});curl --globoff 'https://httpbin.org/anything?source=devtoolsy' --location --header 'Content-Type: application/json' --data-raw '{"message":"Hello, API!","active":true}'Example data only. Values, authentication and endpoint behavior must be checked in your own context.
Browser context and the base URL
A relative URL is resolved against the Base URL you provide. Browser cookie jars and credential settings cannot be copied into a shell process as private cookie values.
Running the command elsewhere
The output is quoted for a POSIX shell and is not executed by the page. Review URL, headers, body and authentication before running it or sharing the downloaded script.
Local tools accept up to 1 MiB, URLs up to 64 KiB, and have a 5-second processing limit. API requests support 100 headers and 100 parameter rows, a 1–120 second timeout and up to 5 MiB of received response data. Long text previews are abbreviated. Requests go directly to your chosen endpoint; CORS and browser policy apply.
Frequently asked questions
Can I paste arbitrary JavaScript?
No. The parser accepts supported literal request data. It reports dynamic values and unsupported syntax rather than executing them.
Are browser cookies copied into cURL?
No. A cURL process does not share your browser cookie jar. Credential settings are explained as context, not turned into private cookie values.
What should I use as Base URL?
Use the origin and path against which the relative request should resolve. The converter does not infer the original page address from a snippet.
Does it execute response handlers?
No. A supported response-handler chain can be recognized around a request, but its callback code is not run.
Is the result ready for every command-line shell?
No. The output uses POSIX quoting. Windows cmd and PowerShell have different quoting rules and may need an adapted command.