cURL Converter — JavaScript, Python, Go, PHP
Generated code will appear here...
Supports:
- GET, POST, PUT, PATCH, DELETE
- Custom headers (-H)
- JSON body (-d)
- Form data (-F / --data-urlencode)
- Basic auth (-u)
- Multi-line with backslash continuationSupported Features
What This Tool Does
Paste a curl command and get equivalent HTTP request code in six targets: JavaScript fetch, JavaScript axios, Python requests, Node.js http, PHP, and Go. Parsing runs entirely in your browser — no request is sent. It reads headers, JSON and form bodies, and -u basic auth, which it expands into a static Authorization: Basic header. Scrub those credentials before you share the generated code.
Last updated:
This tool is provided as-is for convenience. Output should be verified before use in any production or critical context.
Programmatic Access
cURL Converter — JavaScript, Python, Go, PHP is also callable as a free HTTP JSON API at
https://aidevhub.io/api/curl-converter/ — GET with query
parameters or POST with a JSON body, no authentication, CORS enabled,
50 requests/day per IP. Responses return
{ ok, tool, result, meta }.
curl -s -X POST https://aidevhub.io/api/curl-converter/ \
-H "Content-Type: application/json" \
-d '{"curl":"curl -X POST https://api.example.com/users -H \"Content-Type: application/json\"","lang":"python"}' Machine-readable contract: /api/tool/curl-converter.json All API endpoints: /agents/ LLM site index: /llms.txt
Agent Invocation
Best Path For Builders
Dedicated API endpoint
Deterministic outputs, machine-safe contracts, and production-ready examples.
Dedicated API
https://aidevhub.io/api/curl-converter/ OpenAPI: https://aidevhub.io/api/openapi.yaml
Unified Runtime API
https://aidevhub.io/api/tools/run/?toolId=curl-converter&a=...
GET and POST are supported at /api/tools/run/ with identical validation and limits.
Limit: 30 req / 60s, input max 256 KB.
How to Use cURL Converter — JavaScript, Python, Go, PHP
- 1
Paste your cURL command
Copy any cURL command from your terminal, browser DevTools, API docs, or Postman and paste it into the left panel. Multi-line commands with backslash continuation are supported automatically.
- 2
Select target language
Click a language tab — JS (fetch), JS (axios), Python, Node.js http, PHP, or Go — to generate idiomatic code for that language. The output updates instantly without any server calls.
- 3
Review parsed request details
Below the panels, a summary shows the detected HTTP method, URL, and headers extracted from your cURL command. Use this to confirm the parser understood the request correctly before copying.
- 4
Copy or download the code
Click Copy Code to copy to clipboard, or Download to save as a file with the correct extension (.js, .py, .go, .php). Drop it directly into your project.
Frequently Asked Questions
What is cURL Converter?
How do I convert a cURL command?
Is cURL Converter free?
Does cURL Converter send my data to a server?
What cURL options are supported?
How do I convert a curl command to fetch, Python, or Go?
Paste the full curl command, pick a target language, and copy the generated code. The converter tokenizes the command in your browser — handling quoting and backslash line continuations — then rebuilds the request using each language's idiomatic HTTP client. No call is made; it only translates the command into source code.
Step by step
- Paste a command starting with
curl— single and double quotes and multi-line\continuations are supported. - Choose a target: JS fetch, JS axios, Python, Node.js http, PHP, or Go.
- Read the parsed request summary (method, URL, headers) to confirm it was understood.
- Copy the generated code or download it as a file with the right extension.
curl flags this converter understands
| Flag | How it is translated |
|---|---|
| -X, --request | Sets the HTTP method |
| -H, --header | Added to the request headers |
| -d, --data, --data-raw, --data-binary | Request body; JSON is auto-detected, and the method defaults to POST |
| --data-urlencode | Field in an application/x-www-form-urlencoded body |
| -F, --form | Field in a multipart/form-data body |
| -u, --user | Encoded into an Authorization: Basic header (base64) |
| -L, -s, -v, --compressed, -k | Recognized, but do not change the generated code |
Flags as this converter parses them. Options outside this set are skipped rather than translated, so review the parsed summary if a request looks incomplete.
Does it handle JSON and form bodies correctly?
Yes, and it picks the matching body type per language. A -d payload that starts with { or a JSON Content-Type becomes a real JSON body (JSON.stringify, json=, and so on); --data-urlencode maps to url-encoded form data and -F to multipart. That is why the axios and requests output uses URLSearchParams or files= rather than sending a plain object.
Which languages and libraries can it output?
Six targets: browser fetch, axios, Python requests, the Node.js built-in http/https module, PHP curl_*, and Go net/http. The Node output even selects http or https based on the URL scheme, since using the wrong one fails the TLS handshake.
Is my curl command sent anywhere?
No. The command is parsed and converted in the page; nothing is transmitted. curl commands frequently contain API keys, cookies, and bearer tokens, so translating them locally — and scrubbing any -u or Authorization value before sharing the code — keeps those secrets off the network.