cURL Converter

Overview

The cURL converter translates cURL commands into ready-to-run HTTP client code for 40+ languages and frameworks. Paste a curl command, pick a target language, and get equivalent request code with syntax highlighting. It is most useful when an API guide shows a curl example and you need it in Python, Go, or another language without rewriting the headers and body by hand.

A real conversion example

Input — a GET request with an auth header:

curl -X GET "https://api.example.com/users?page=1&limit=10" \
  -H "Authorization: Bearer eyJhbGci..."

Python requests output:

import requests

url = "https://api.example.com/users"
params = {"page": "1", "limit": "10"}
headers = {"Authorization": "Bearer eyJhbGci..."}

response = requests.get(url, params=params, headers=headers)
print(response.json())

Node.js fetch output:

fetch("https://api.example.com/users?page=1&limit=10", {
  headers: { "Authorization": "Bearer eyJhbGci..." }
}).then(r => r.json()).then(console.log);

Supported target languages

Popular languages and Node.js

  • Python (requests / http.client)
  • JavaScript (native Fetch / XHR / jQuery)
  • Node.js (Axios / Fetch / Got / Ky / SuperAgent)
  • Java (HttpURLConnection / OkHttp)
  • Go, Kotlin, Swift, Dart, Rust

Other languages and tools

  • PHP (native / Guzzle)
  • C, C#, Ruby (native / HTTParty)
  • PowerShell, R, Elixir, Julia, Lua
  • Ansible, CFML, Clojure, Perl, Wget

How common curl flags map to generated code

curl flagWhat it meansWhere it shows up
-X POSTHTTP methodPOST call in target language
-H "Content-Type: ..."Request headerheaders object
-d '{"key":"val"}'JSON bodybody / data parameter
-F "[email protected]"Multipart uploadfile read + multipart form
-u user:passBasic authAuthorization header or auth param
-b "session=abc"CookieCookie header

When conversion fails or produces wrong output

The parser depends on standard curl syntax. The most reliable source is the "Copy as cURL" option from a browser DevTools Network tab — that format is always well-formed.

Common causes of failure:

  • Curly quotes (") instead of straight quotes (") — usually introduced by pasting from a word processor or PDF
  • Incomplete line continuations: each backslash \ must be the very last character on the line with no trailing space
  • Non-standard flags or shell substitutions ($(...), backticks) — the converter parses literal values only