Skip to content
Mediawand

cURL to Code Converter

Turn a curl example from API docs, or a request copied from your browser's dev tools, into code you can paste into your app: JavaScript fetch, Node.js axios or Python requests.

How to convert curl to code

  1. 1Paste a curl command; line continuations with \ are fine.
  2. 2Choose fetch, axios or Python requests.
  3. 3Copy the code into your project.

What's understood

The method, URL, headers, request bodies (-d, --data-raw, --data-urlencode, --json), form uploads (-F), basic auth (-u), cookies, user agent, referer and -G query strings. Flags that don't affect the request, like -s and -L, are skipped.

Readable output

JSON bodies become real objects (and Python dicts) instead of strings, form-encoded bodies become dictionaries for requests, and multipart uploads use FormData or files=.

Copy as cURL

In Chrome, Edge or Firefox dev tools, right-click a request in the Network panel and choose Copy as cURL (bash) to get a command to paste here.

Frequently asked questions

Are my tokens sent anywhere?
No. The command is converted in your browser; headers and tokens stay on your device.
What about -k?
Python gets verify=False. Browsers can't skip certificate checks, so the fix there is a valid certificate.

Related tools

Loading tools…