๐Ÿ”’ Runs in your browser โ€” nothing is uploadedโœ“ Free, no signup

cURL to Code Converter

Paste a curl command โ€” for example from your browser's DevTools 'Copy as cURL' โ€” and get equivalent code for fetch, axios, Python requests, PHP or Go.

0 characters

JavaScript (fetch)

Loading...

When should you use the cURL to Code?

  • Reproducing a browser request in code using DevTools 'Copy as cURL'
  • Turning API documentation examples into working code
  • Moving a request from the terminal into a script or app

How to use the cURL to Code

  1. 1

    Copy a curl command

    In Chrome or Firefox DevTools, right-click a request โ†’ Copy โ†’ Copy as cURL. Or use an example from API docs.

  2. 2

    Paste it

    Multi-line commands with \ or ^ line breaks work.

  3. 3

    Choose a language

    fetch, axios, Python requests, PHP cURL or Go net/http.

  4. 4

    Copy the code

    Copy the code and replace any secrets with environment variables.

Examples

JSON POST to Python

curl

curl -X POST https://api.example.com/users \
  -H 'Content-Type: application/json' \
  -d '{"name": "Ada"}'

Python

import requests

payload = {
    "name": "Ada",
}

response = requests.post("https://api.example.com/users", json=payload)
print(response.status_code)
print(response.json())

Common errors and how to fix them

Paste a command that starts with curl
Remove anything before curl, such as a $ prompt or a shell variable.
A quote is never closed
The command was cut off or mixes quote styles. Copy it again from the source.
Related tools:ย URL Parser ยท JSON Formatter ยท Base64 Encoder & Decoder

More from Code Formatters & Minifiers

Free tools that run in your browser โ€” no signup, nothing uploaded.

cURL to Code FAQ

-X, -H, -d / --data / --data-raw / --data-binary, --data-urlencode, --json, -F (forms and file uploads), -u (basic auth), -b (cookies), -A (user agent), -e (referer), -G, -I and -L. Output-only flags like -s and -o are ignored.

Yes, including the Windows (cmd) version with ^ line breaks.

user:password becomes an Authorization: Basic header with the Base64-encoded credentials.

No. The tool only converts the command into code โ€” nothing is sent anywhere, so tokens in the command stay private.

When the body is JSON it becomes an object: JSON.stringify(...) for fetch, data for axios and json= for Python requests.

No. Everything runs in your browser, so your command never leaves your device.