cURL to fetch
Convert a bounded cURL command into a redacted, reviewable fetch request without sending it.
How it works & useful details
Local-only workspace
This tool converts or inspects pasted text in your browser. It never sends a request, opens a URL, uploads a HAR, or stores your input.
Supported cURL syntax
Use basic quoted arguments with one HTTP(S) URL plus -X, -H, -d, --url, -u, or -I. Shell variables, command substitutions, multipart files, and unsupported flags are rejected rather than interpreted.
About this tool
cURL to fetch converts a pasted cURL command into a JavaScript fetch snippet you can read, review, and paste into your own code. It is meant for turning commands you copied from API docs or a terminal history into something you can debug in the browser.
The conversion runs locally and never sends a request: the fetch call is produced as inert text. Sensitive values are redacted by default, so a token or cookie in the original command is replaced before it appears in the result.
How to use it
- Paste the cURL command into the input area.
- Review the parsed method, URL, headers, and body shown by the workspace.
- Generate the fetch snippet and check any warnings about unsupported flags.
- Copy the result into your project and restore real credentials from your own secret store.
Worked example
curl 'https://api.example.com/v1/notes?limit=10' -X POST \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer example-token' \
--data '{"title":"Morning notes"}'becomes
fetch("https://api.example.com/v1/notes?limit=10", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Authorization": "[redacted]"
},
body: "{\"title\":\"Morning notes\"}"
});The Authorization value is redacted by default, so the snippet can be pasted into a ticket or chat without leaking the token. Enable "include sensitive values" only when you need a working local copy.
Where cURL commands come from
API documentation, Postman, and browser DevTools (Network panel → right-click → Copy as cURL) all produce cURL commands. Converting one to fetch gives you a starting point for browser or Node.js code with the same method, headers, and body.
Supported flags are -X/--request, -H/--header, -d/--data, --url, -u/--user, and -I/--head. Commands with shell variables ($TOKEN), command substitution, file uploads (-F @file), or other flags are rejected instead of half-converted, because a silently dropped flag, such as a missing header, produces a request that behaves differently. Nothing is sent. The tool only rewrites text.
Frequently asked questions
Does this tool call the URL in my command?
No. The output is generated text only. Nothing is requested, and the URL is never contacted.
Are credentials kept in the result?
Sensitive header and body values are redacted by default. If you need a complete snippet, review the redaction notes and re-enter the values yourself.
What limits apply?
Commands are limited to 40,000 characters, and only a bounded set of common cURL flags is interpreted. Unsupported flags are reported instead of being silently ignored.
Why does fetch fail in the browser when cURL works?
Browsers enforce CORS: the API must allow requests from your page's origin. cURL has no such restriction. Run the snippet in Node.js, or call the API from your own server, if the API does not send CORS headers.
