cURL to Fetch
Turn a cURL command into JavaScript Fetch code without making a request.
Runs on your device. Nothing you add is uploaded.
Fetch code
const response = await fetch("https://example.com/readings", {
"method": "POST",
"headers": [
[
"Accept",
"application/json"
],
[
"Content-Type",
"application/json"
]
],
"body": "{\"celsius\":19}",
"redirect": "manual"
});How to use cURL to Fetch
- Paste a cURL command with one HTTP or HTTPS URL.
- Review the generated method, headers, and body.
- Copy the Fetch code into your project.
Questions
Which cURL options are supported?
Common request options include the method, headers, inline data, JSON, GET query conversion, and redirects. Replace file references and shell substitutions with literal values first.
Will the generated code always work in a browser?
The browser applies CORS and can restrict some request headers. The converter only generates source code.
Where is my input processed?
On your device. The tool does not upload the input or its result.
How this works
Tokenizes a literal cURL command and serializes its request options as JavaScript.
Everything happens in this browser tab. What you type or add stays on your device, and the page has no tracking. Your last settings are kept in this browser so the tool opens the way you left it. Privacy
Related tools
More in DeveloperJSON Formatter
Indent JSON so objects and arrays are easy to read.
JSON Escape / Stringify
Escape plain text as a JSON string or decode a quoted JSON string.
JSON Viewer (Tree)
Explore JSON objects and arrays in a collapsible tree.
JSON Validator
Check JSON syntax and locate the first problem by line and column.