Web Dev Helpers

cURL Converter

Convert a curl command to Python, Go, PHP, Java, JS fetch and other languages.

curl command

Handles: -X, -H, -d / --data / --data-raw / --data-urlencode, -F, --form, --request, --compressed, --user, --user-agent, --referer, --cookie, --location. Flags without an equivalent (e.g. --insecure, --max-time) are silently dropped.

Python (requests)

import requests

url = 'https://api.example.com/v1/users'
headers = {
    'Content-Type': 'application/json',
    'Authorization': 'Bearer YOUR_TOKEN',
}
payload = '{"name":"Ada","role":"admin"}'

response = requests.request('POST', url, headers=headers, data=payload)
print(response.text)

About this tool

Paste any curl command and pick a target language. Emits idiomatic code for CFML (cfhttp), Dart (package:http), Elixir (HTTPoison), Go (net/http), Java (java.net.http.HttpClient), JavaScript fetch, JSON (structured request), MATLAB (weboptions + webwrite), Node.js with Axios, Node.js with global fetch, Node.js with Request, PHP (curl_setopt_array), Python (requests), R (httr) and Rust (reqwest). Handles -X, -H, -d / --data / --data-raw / --data-urlencode, -F / --form, -u / --user (basic auth), --user-agent, --referer, --cookie, --compressed and --location. Backslash-escaped newlines are collapsed, quoted arguments are parsed correctly. Runs entirely in the browser - the curl command and generated code never leave your machine.

FAQs

Which curl flags does it understand?

-X / --request, -H / --header, -d / --data / --data-raw / --data-binary / --data-urlencode, -F / --form, -u / --user, -A / --user-agent, -e / --referer, -b / --cookie, --compressed and -L / --location. Flags without a direct equivalent in the target library (--insecure, --max-time, --cert, etc.) are silently ignored.

Is the output production-ready?

It's a solid starting point that compiles and runs against most APIs, but treat it as a scaffold. Multipart bodies, file uploads and streaming responses often need library-specific tweaks - the tool picks the most common approach for each language.

How does JSON output differ from the others?

JSON emits a structured object describing the request (url, method, headers, body, auth) rather than executable code. If the Content-Type header indicates JSON, the body is parsed and inlined as an object; otherwise it's kept as a string. Useful for feeding the request into another tool or a test harness.

Other tools