🔌 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

Paste a cURL command above and click Convert.

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

  1. Paste into cURL Command, or click a sample: GET Request, POST JSON, POST Form, With Auth or With Headers.
  2. Click Convert, or press Ctrl+Enter. After editing the command, convert again.
  3. Pick a tab: JS (fetch), JS (axios), Python, PHP, Go, Ruby, Java or C#.
  4. 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:

InputResult
-XPOST https://..."No URL found" error. Write -X POST with a space.
-s example.com/aSame error. An unknown flag takes the next word as its value unless that word starts with http:// or https://.
-d a=1 -d b=2Only b=2 is kept. curl would send a=1&b=2.
--data-urlencode, --jsonDropped, leaving a GET with no body.
-I, -GIgnored. The method stays GET or POST as if they were absent.
-d @body.jsonThe literal text @body.json becomes the body.
Repeated -H 'Accept: ...'Only the last one survives.
An unmatched quoteThe 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

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.