API & HTTP
cURL to Fetch Converter
Convert cURL commands into browser Fetch calls.
cURL to Fetch Converter workspace
Input
Preparing tool…
Result
Preparing tool…
How it works
Documentation
About cURL to Fetch Converter
Convert one statically resolvable HTTP or HTTPS cURL command into modern browser Fetch JavaScript. Only a documented static subset of cURL is supported. SyntaxDock parses the command as data; it never runs cURL or performs the represented request.
How to convert
Paste a cURL command, choose Convert to Fetch, and copy the generated JavaScript if it suits your browser application. SyntaxDock never executes the cURL text or the generated Fetch code.
Supported cURL options
The converter supports -X/--request, -H/--header, -d/--data, --data-ascii, --data-raw, --data-binary, --data-urlencode, --json, -G/--get, -F/--form, --form-string, -u/--user, -b/--cookie, -A/--user-agent, -e/--referer, -L/--location, --no-location, -I/--head, --compressed, -k/--insecure, and --url. Separate values, --option=value, and unambiguous attached short-option values are accepted.
Harmless response and output controls are accepted and ignored: -s/--silent, -S/--show-error, -v/--verbose, -i/--include, -o/--output, -O/--remote-name, and --progress-bar. They do not change a browser request.
Request methods
GET is the default. Data, JSON, and forms imply POST; --head implies HEAD; --get appends supported data to the URL query; and the last explicit request method wins. CONNECT, TRACE, and TRACK cannot be represented by browser Fetch. GET and HEAD requests with a body are rejected rather than rendered misleadingly.
Headers
Headers preserve their source order and duplicates. Browser-controlled headers such as Cookie, Host, Content-Length, Origin, Referer, Set-Cookie, Proxy-*, and Sec-* are omitted with a warning. User-Agent is also omitted because browsers may control it. A suitable cURL referer becomes Fetch referrer, not a request header.
POST and JSON bodies
Repeated ordinary data options join with &; repeated --json values concatenate directly. Plain data receives application/x-www-form-urlencoded unless you set Content-Type. --json supplies JSON Content-Type and Accept headers unless you override them. JSON text is preserved as text, not parsed or reformatted.
Query parameters
With --get, supported data becomes ordered query parameters after any existing query and before a fragment. URL-encoded data uses percent encoding with spaces encoded as %20.
FormData
Simple literal --form and --form-string fields become browser FormData. SyntaxDock does not supply a multipart boundary or a multipart Content-Type header; the browser creates them when the generated code runs.
Authentication
Static --user user:password becomes Basic Authorization during local conversion. An explicit Authorization header takes precedence. Interactive credentials and non-Basic authentication modes are not supported.
Cookies
Literal cURL cookie intent becomes credentials: "include"; cookie values are not copied into generated code. The browser manages cookies for the target origin, so cookie behavior is not equivalent to cURL. Cookie-file input is not supported.
Redirects
Generated Fetch defaults to redirect: "manual". --location selects "follow", and --no-location returns to manual redirects. Manual redirect responses can be opaque in browsers, and credentials can behave differently across redirects.
Browser-only Fetch limitations
Browser Fetch is not byte-for-byte equivalent to cURL. Browsers manage content encoding, TLS, cookies, and parts of the request headers. --compressed is browser-managed; --insecure cannot disable TLS verification and produces a warning. Proxy, SOCKS, resolve, connect, interface, Unix-socket, certificate, key, CA, and maximum-redirect options produce warnings when a direct browser Fetch conversion remains useful.
CORS
CORS still applies when you later run the generated code in a browser. SyntaxDock does not add mode: "no-cors", because that would not reproduce a readable cURL response. Your target server must permit the browser origin, method, headers, and credentials you use.
Unsupported shell syntax
The command must be static: cURL or curl.exe with ordinary quoting, supported escapes, and line continuations. Environment assignments, variable expansion, command substitution, backticks, pipelines, command separators, redirections, multiple requests, and unsupported options stop conversion. Unsupported options, dynamic shell syntax, multiple requests, and unavailable file input stop conversion.
File-backed request bodies
File-backed data, JSON, form fields, headers, and cookie files are not available to this browser-local converter. Data modes that read @file, multipart file fields, and advanced multipart metadata stop conversion instead of accessing a file.
Privacy
Your cURL text and generated Fetch stay local in this browser. SyntaxDock does not upload, store, execute, or send the command, URL, headers, authentication, request body, or generated output to a represented endpoint.
Input is limited to 1 MiB and generated Fetch output to 2 MiB. Oversize input or output is rejected without truncation.
FAQ
Why did conversion stop? Check for dynamic shell behavior, more than one request, unsupported options, file input, or a Fetch-incompatible method or body. Why was a header omitted? Browsers control some headers and Fetch cannot set them reliably. Does the converter call my API? No. It only generates source text locally.
Related tools
Use Fetch to cURL for the reverse conversion, JSONPath Tester to inspect JSON responses, and JSON Diff to compare JSON documents.
For examples and workflow details, read the cURL to Fetch guide.