SyntaxDock guide
How to Convert cURL to Fetch
Translate a cURL request into a browser Fetch call while preserving its method, headers, and body.
Convert request text without executing it
Paste a supported cURL command into the cURL to Fetch Converter, then select Convert to Fetch. Inspect the generated code and diagnostics before copying. SyntaxDock never executes the command, the generated JavaScript or the represented request. Conversion stays in your browser.
Map the method and headers
curl 'https://example.com/items?limit=5' \
-X POST \
-H 'Content-Type: application/json' \
--data-raw '{"name":"sample"}'
The URL becomes the Fetch URL argument. The method and supported headers become options. Body flags can imply POST when no explicit method is present, while -G moves supported data into the query string. Review diagnostics when combinations cannot be represented safely. The example contains no credentials and is never sent by the converter.
JSON and raw request bodies
A JSON-looking body is still request text; the content type tells the recipient how to interpret it. SyntaxDock preserves supported body content in generated JavaScript rather than running it. Shell quoting and JavaScript string escaping differ, so use the generated representation instead of pasting shell quotes directly into Fetch.
URL-encoded data and query parameters
Supported URL-encoded data is converted according to the option's encoding semantics. Existing query parameters remain part of the URL. Do not assume raw data and URL-encoded data are interchangeable: spaces, plus signs and percent escapes can change meaning. Review the generated URL and body, especially when combining repeated data options.
Multipart text fields
Supported text-only multipart fields become a FormData representation. Browser FormData supplies the multipart boundary; manually retaining a boundary from a captured request would be misleading. File uploads, file-backed data such as --data @payload.json, and shell substitutions cannot be resolved from static text and are rejected rather than read or executed.
Browser-controlled behavior and credentials
Browsers control some request headers, cookies, redirects and cross-origin behavior. A syntactically valid Fetch call may be blocked by CORS or differ from cURL's networking behavior. Conversion cannot bypass those browser rules. Review credential-related warnings and avoid treating captured Cookie headers as a portable browser authentication mechanism.
Static conversion limits and the reverse workflow
SyntaxDock accepts a supported subset of cURL options, not a complete shell script. Pipelines, command substitution, environment expansion, file access and arbitrary execution are outside the conversion contract. Input is limited to 1 MiB and generated output to 2 MiB; oversized content is rejected without truncation.
For the reverse direction, use the Fetch to cURL Converter. It statically parses supported Fetch expressions without evaluating JavaScript. Runtime values, arbitrary function calls and application state cannot be reconstructed. Review either conversion in your own application context before running a request elsewhere.