🔌 cURL to Code Converter
Convert cURL commands to code in multiple programming languages. Runs entirely in your browser.
Last updated: November 8, 2026 · By the BoltQuickTools team
Moving a working curl command into your application
You have an API call that works in the terminal or came from a vendor's docs, and you need it in your code. Paste it here to get a starting version in eight languages, then review it, since not every option carries over.
Converting a command
- Paste into cURL Command, or click a sample: GET Request, POST JSON, POST Form, With Auth or With Headers.
- Click Convert, or press Ctrl+Enter. After editing the command, convert again.
- Pick a tab: JS (fetch), JS (axios), Python, PHP, Go, Ruby, Java or C#.
- Click Copy.
The conversion is string handling in the page's script, and nothing in that script sends your command anywhere. Keep in mind that any token you paste ends up in plain text in the generated code. Move it to an environment variable before you commit.
Example
curl -X POST https://api.example.com/users \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer abc123' \
-d '{"name": "Ada", "active": true}'
The Python tab gives:
import requests
url = 'https://api.example.com/users'
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer abc123'
}
json_data = {
"name": "Ada",
"active": True
}
response = requests.post(url, headers=headers, json=json_data, allow_redirects=False)
print(response.status_code)
print(response.text)
JSON bodies are detected and turned into native structures, with true rewritten as True for Python.
Flags it understands, and those it does not
Recognised: -X, -H, -d, --data-raw, --data-binary, -u, -b, -A, -F, -L, -k, --compressed, their long forms, and bundles of no-value flags such as -sSL. Other input can produce wrong code without any error:
| Input | Result |
|---|---|
-XPOST https://... | "No URL found" error. Write -X POST with a space. |
-s example.com/a | Same error. An unknown flag takes the next word as its value unless that word starts with http:// or https://. |
-d a=1 -d b=2 | Only b=2 is kept. curl would send a=1&b=2. |
--data-urlencode, --json | Dropped, leaving a GET with no body. |
-I, -G | Ignored. The method stays GET or POST as if they were absent. |
-d @body.json | The literal text @body.json becomes the body. |
Repeated -H 'Accept: ...' | Only the last one survives. |
| An unmatched quote | The quoted text runs to the end of the command with no warning. If the URL was inside it, you get the "No URL found" error. |
-d 'it'\''s' | The body is cut to it. If no URL came before it, the leftover ''s' is taken as the URL. |
| Windows "Copy as cURL (cmd)" | ^ escapes are not understood. Copy the bash version. |
How the languages differ
- File uploads (
-F 'x=@file') are real code only in PHP and Python. fetch and C# show a commented-out line, while Go and Ruby leave a note. - JS (axios) emits no form fields at all for
-F, only a comment. - Go with
-Fdoes not compile, becausemime/multipartis not imported. - Java with
-Fposts a plainkey=valuestring, not multipart.-konly adds imports and does not disable certificate checks, andHttpURLConnectionrejects PATCH. - Ruby ignores
-Land writes JSONnullas-is, which is not defined in Ruby. - Python sends
-bcookies as a header and adds a placeholdercookiesdict. Delete the dict. - fetch in a browser cannot set
Cookie, and-khas no effect. It also assumes a JSON response.
Content types, shell variables and testing
Why is my form POST rejected after converting?
curl adds Content-Type: application/x-www-form-urlencoded for -d by itself, but the generated code only sets headers you wrote. Add -H for it and convert again.
Does it expand $TOKEN?
No. It is copied literally, so replace it in your code.
How can I test the request first?
The API tester sends requests from your browser, so that one does make network calls. The article on API testing compares approaches, and the Basic Auth header generator builds the value that -u produces.