cURL to Fetch Converter
Paste a cURL command and get JavaScript fetch() code instantly. Supports headers, request body, Basic auth, and both async/await and Promise chain styles.
Frequently Asked Questions
What is cURL?
cURL is a command-line tool for transferring data with URLs. It is widely used by developers to test APIs, inspect HTTP responses, and script network requests. API documentation frequently provides example requests as cURL commands because cURL is available on virtually every platform.
When should I use fetch() instead of cURL?
Use cURL when working in a terminal or shell scripts. Use fetch() when writing JavaScript or TypeScript code in the browser or Node.js. The converter helps you translate API documentation examples (which often use cURL) into code you can paste directly into your JavaScript project.
How does the tool handle authentication?
Bearer tokens passed via -H "Authorization: Bearer …" are preserved as-is in the headers object. Basic auth credentials passed via -u username:password are automatically converted to a Base64-encoded Authorization: Basic … header, matching the behavior of cURL's own -u flag.
Is my cURL command sent to a server?
No. The entire conversion runs in your browser using JavaScript. Your cURL commands — which may contain API keys or credentials — never leave your machine.