</>DevTools

cRLcURL Converter

Convert cURL commands to code (Python, JS, Go)

cURL Command Complete Guide

cURL Converter instantly translates cURL commands into ready-to-use Python, JavaScript, or Go code. Copy a network request as cURL from browser DevTools and convert it directly into your codebase — dramatically speeding up API integration work.

cURL Options Reference

cURL has hundreds of options, but knowing the core ones for API work is sufficient.

Request Method and URL

# GET request (default)
curl https://api.example.com/users

# POST request (-X specifies the method)
curl -X POST https://api.example.com/users

# Long commands use backslash line continuation
curl -X POST \
  https://api.example.com/users \
  -H 'Content-Type: application/json' \
  -d '{"name": "John"}'

Headers (-H option)

# Auth header
curl -H 'Authorization: Bearer YOUR_TOKEN' https://api.example.com/me

# Multiple headers
curl -H 'Content-Type: application/json' \
     -H 'X-API-Key: secret123' \
     https://api.example.com/data

Sending Data (-d, --data-raw, -F)

# JSON body
curl -X POST https://api.example.com/posts \
  -H 'Content-Type: application/json' \
  -d '{"title": "Hello", "body": "World"}'

# URL-encoded form data
curl -X POST https://api.example.com/login \
  --data-urlencode 'username=user' \
  --data-urlencode 'password=p@ss!'

# File upload (multipart)
curl -X POST https://api.example.com/upload \
  -F 'file=@/path/to/file.pdf'

Language Conversion Comparison

Python (requests)

import requests

headers = {
    "Authorization": "Bearer TOKEN",
    "Content-Type": "application/json"
}
data = '{"name": "test"}'

response = requests.post(
    'https://api.example.com/users',
    headers=headers,
    data=data
)
print(response.status_code)
print(response.json())

JavaScript (fetch)

const response = await fetch('https://api.example.com/users', {
  method: 'POST',
  headers: {
    "Authorization": "Bearer TOKEN",
    "Content-Type": "application/json"
  },
  body: '{"name": "test"}'
});

const data = await response.json();
console.log(data);

Common Mistakes and Fixes

  • Quote errors — Windows CMD does not support single quotes. Replace with double quotes or use PowerShell.
  • Multiline paste — Commands with backslash line continuations must be joined into one line for accurate parsing.
  • Special character escaping — Double quotes in JSON body need shell escaping (\") in the terminal.
  • SSL certificate errors — Use -k to skip verification in test environments (never in production).

Frequently Asked Questions

  • How do I copy cURL from the browser? — DevTools → Network tab → right-click a request → Copy as cURL (bash)
  • What is the difference between -d and --data-raw? — --data-raw sends data as-is without @ special handling. Browser-copied cURL mostly uses --data-raw.
  • Is PHP conversion supported? — Currently Python, JavaScript, and Go are supported.
  • Are URL-encoded values handled automatically? — %xx URL-encoded data may need manual decoding in some cases.

Tip: Paste cURL examples directly from API documentation into this tool to instantly get working Python/JS/Go code.

🔗Related Tools🌐 Network / API