cURL to Node.js

Paste a curl command and get equivalent Node.js code using the built-in fetch API, with headers, JSON body, cookies, and auth already translated.

curl Command

Node.js (fetch)

Summary

Paste a curl command and get equivalent Node.js code using the built-in fetch API, with headers, JSON body, cookies, and auth already translated.

How it works

  1. Paste a curl command, including one copied from a browser devtools network tab.
  2. The parser tokenizes the command, honoring quotes and backslash line continuations.
  3. Flags such as -X, -H, -d, -b, -u, -F, and -G are mapped to fetch() options.
  4. A JSON body is detected automatically and rendered with JSON.stringify() instead of a raw string.
  5. The generated Node.js script appears in the output box, ready to copy and run with node.

Use cases

  • Turn a "Copy as cURL" request from browser devtools into a Node.js script.
  • Reproduce an API call from documentation or a support ticket in Node.js.
  • Convert a curl example from a README into a starting point for a backend service.
  • Debug an API integration by replaying the exact request curl sent, in Node.js.
  • Translate a webhook test command into a repeatable Node.js script.
  • Build a quick script around a request captured from a mobile app proxy.

Frequently Asked Questions

Last updated: 2026-07-23 · Reviewed by Nham Vu