Menu

cURL Converter

Convert any curl command into fetch, axios, Python requests, Go, PHP, and more.

Last updated

Paste curl commandPaste a curl command to begin
JavaScript (fetch)
Paste a curl command above to generate code in 12 languages.

What is a cURL converter?

A cURL converter turns a curl command — the format every API doc, Postman export, and AI assistant emits — into ready-to-paste code for your real programming language. Headers, query strings, JSON bodies, multipart uploads, basic auth, and cookies all carry over, so you don't have to translate the request by hand.

curl is the universal way to describe an HTTP request, but you rarely *run* curl in production. You run JavaScript fetch, Python requests, Go's net/http, or whatever your stack uses. This tool bridges that gap: paste the curl, click a tab, copy the code.

Everything runs locally in your browser. Your curl command, headers, and tokens never leave your machine — useful when you're pasting commands that include real bearer tokens or session cookies.

What you'll learn while converting

  • Curl flags map to specific concepts in every HTTP client: -H is a request header, -d is a body, -X is the method, -u is basic auth, -F is a multipart form field.
  • If curl sees a body (-d, --data, -F) and no -X, it defaults to POST — the same default most clients use, so an unspecified -X still becomes POST in the output.
  • JSON bodies are different from form bodies. Content-Type: application/json means the body is sent literally; application/x-www-form-urlencoded means key/value pairs are joined with &.

How to convert curl to code step by step

  1. Paste your curl command

    Drop the full command — including \ line continuations from copy-pasted docs — into the input box. The parser normalizes smart quotes and PowerShell prompt markers automatically.

  2. Pick the target language

    Tabs cover JavaScript fetch, TypeScript, Node axios, Python requests, Python httpx, Go, PHP, Ruby, Java HttpClient, C# HttpClient, HTTPie, and PowerShell. Switching tabs is free — the parse runs once.

  3. Inspect the parsed request

    Open the *Parsed request* panel to confirm the method, URL, headers, body kind, and any options like insecure or follow redirects came across the way you expected.

  4. Copy and adjust auth

    Copy the generated code into your project. If the curl included a bearer token or cookie, swap the literal value for an environment variable before committing.

cURL flags quick reference

The flags this converter understands and what they map to in generated code.

FlagMeaningExample
-X, --requestHTTP method-X POST
-H, --headerRequest header (repeatable)-H 'Accept: application/json'
-d, --dataRequest body — URL-encodes by default-d 'name=Ada&age=30'
--data-rawBody without @file expansion--data-raw '$body'
--data-urlencodePercent-encode a body part--data-urlencode 'q=hello world'
-F, --formMultipart form field (use @file for files)-F 'avatar=@photo.jpg'
-u, --userBasic auth → Authorization: Basic …-u alice:s3cret
-G, --getPromote body to query string, send GET-G -d 'q=ada'
-b, --cookieCookie header-b 'session=abc'
-A, --user-agentUser-Agent header-A 'MyApp/1.0'
-L, --locationFollow 3xx redirects-L
-k, --insecureSkip TLS verification (dev only!)-k
--compressedAccept gzip/deflate/br response--compressed
--max-timeWhole-request timeout in seconds--max-time 30

cURL conversion examples

GET with query string and auth header

curl
curl 'https://api.example.com/v1/lessons?limit=20&track=python' \  -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiJ9.demo'
JavaScript (fetch)
const response = await fetch('https://api.example.com/v1/lessons?limit=20&track=python', {  method: 'GET',  headers: {    'Authorization': 'Bearer eyJhbGciOiJIUzI1NiJ9.demo'  }});const data = await response.json();

Query parameters in the URL stay in the URL — the converter does not re-split them into a separate params object for fetch. For axios and requests, you'll see them lifted into params / params= for readability.

POST a JSON body

curl
curl 'https://api.example.com/v1/users' \  -H 'Content-Type: application/json' \  --data-raw '{"name":"Ada","age":36}'
Python (requests)
import requests
headers = {    'Content-Type': 'application/json',}json_data = {"name":"Ada","age":36}
response = requests.post('https://api.example.com/v1/users', headers=headers, json=json_data)response.raise_for_status()

When the body parses as JSON and Content-Type is application/json, the converter emits json= for requests and data: (parsed object) for axios. The original literal string is preserved when JSON.parse fails — never rewritten.

Multipart file upload

curl
curl 'https://api.example.com/upload' \  -F 'caption=Hello' \  -F 'photo=@./avatar.jpg'
Python (requests)
import requests
files = {    'caption': (None, 'Hello'),    'photo': open('./avatar.jpg', 'rb'),}
response = requests.post('https://api.example.com/upload', files=files)response.raise_for_status()

-F field=@file becomes a real file upload (open('…', 'rb') in Python, FormData.append in JavaScript). Plain -F fields become regular form values. The browser preview shows a TODO placeholder for file blobs you'll need to provide at runtime.

Basic auth + cookie

curl
curl 'https://api.example.com/me' \  -u alice:s3cret \  -b 'session=2f9a; theme=dark'
JavaScript (fetch)
const response = await fetch('https://api.example.com/me', {  method: 'GET',  headers: {    'Authorization': 'Basic YWxpY2U6czNjcmV0',    'Cookie': 'session=2f9a; theme=dark'  }});

Basic auth is collapsed into a single Authorization header. Cookies are joined with ; and sent as one Cookie header — matching what curl does on the wire.

Common mistakes when converting curl

  • Pasting curl with smart quotes (', ', ", ") from a blog post — they look like quotes but break shell parsing. The converter normalizes them, but copy the original command if you can.
  • Leaving -k (--insecure) in production. It disables TLS certificate verification — fine for local dev, dangerous in real traffic.
  • Forgetting that --data-raw and --data behave differently — --data URL-encodes the input. Use --data-raw for JSON bodies that include @ or &.

cURL Converter FAQ

Which languages does the converter support?
Twelve targets out of the box: JavaScript (fetch), TypeScript (fetch), Node (axios), Python (requests), Python (httpx), Go (net/http), PHP (curl), Ruby (Net::HTTP), Java (HttpClient), C# (HttpClient), HTTPie, and PowerShell (Invoke-RestMethod). Each is generated from the same parsed representation — switching tabs is instant.
Does it handle multipart uploads and -F flags?
Yes. -F field=value becomes a regular form field, -F file=@path becomes a real file upload using FormData (JS), files= (Python), CURLFile (PHP), and so on. File paths show up as TODO placeholders you'll need to wire to a File, Buffer, or stream at runtime.
Is my curl command sent to a server?
No. The parser and every code generator run in your browser. Bearer tokens, cookies, and request bodies never leave your machine — by default we even mask them in the *Parsed request* preview.
Why does my Windows curl look different?
Windows curl.exe (and CMD/PowerShell) uses ^ or backtick \` as line continuations and may quote strings differently. The converter normalizes the common Windows patterns, but if a paste looks wrong, try copying the command as one line.
Does it support GraphQL requests?
Yes — a GraphQL request is just a POST with a JSON body containing query and variables. Paste the curl, and the converter emits a regular JSON POST in your target language. Treat the response shape ({ data, errors }) the same way you would in any GraphQL client.
Can I paste a Postman-exported curl?
Yes. Postman's *Code → cURL* export is fully supported, including its multi-line \ formatting. So is the curl produced by browser *Copy as cURL* in Chrome and Firefox DevTools.
fetch vs axios — which output should I pick?
Use fetch if your project already has it (it ships with browsers and modern Node). Use axios if you need automatic JSON parsing, request interceptors, retries, or progress events — features fetch doesn't provide out of the box.

Learn more

Other developer tools

Coddy programming languages illustration

Learn to code with Coddy

GET STARTED