If you work with APIs, this is a familiar loop: you copy a curl
command from Postman, an API doc, or your browser's dev tools network tab — and now you need it as actual code in your project. Python requests
? JavaScript fetch
? PHP? You either hand-translate it (slow, error-prone with headers and escaped quotes) or paste it into an AI chatbot and wait.
I got tired of that loop, so I added a curl to code converter to SamToolkit — a free, browser-based dev tools site. Here's why I built it, how it works, and how it's different from most converters out there.
A typical curl command copied from Chrome's "Copy as cURL" looks like this:
curl -X POST https://api.example.com/users \
-H "Content-Type: application/json" \
-H "Authorization: Bearer abc123" \
-d '{"name":"John","email":"john@example.com"}'
Turning that into working Python or JS by hand means manually mapping -X
to a method, -H
to a headers dict, unescaping the -d
payload, and remembering the right syntax for whichever library you're using. It's not hard, it's just tedious — and easy to get subtly wrong (trailing commas, wrong quote escaping, forgetting json=
vs data=
in requests
).
Most people's default is pasting it into an AI assistant. That works, but:
Like every tool on SamToolkit, the curl converter runs entirely client-side — nothing you paste in ever leaves your browser. No server call, no logging, no risk of your Authorization
header ending up in someone's request logs. That matters more than it sounds like it should once you realize how often people paste live tokens into random web tools.
It supports converting curl commands into:
requests
)fetch
)axios
)cURL
/Guzzle
style)It handles the common flags you actually use: -X
/--request
, -H
/--header
, -d
/--data
/--data-raw
, -u
/--user
, and -F
for form data — so headers, JSON bodies, auth, and multipart uploads all convert correctly instead of just the happy-path GET request.
Paste any curl command — from Postman, browser dev tools, or an API doc — and get working code in the language you need:
Does this send my API keys anywhere?
No. The conversion happens entirely in your browser using JavaScript — nothing is transmitted to a server. You can disconnect your internet after the page loads and it'll still work.
Which languages are supported?
Currently Python (requests), JavaScript (fetch), Node.js (axios), and PHP. More are planned based on demand.
Can it handle curl commands with file uploads or basic auth?
Yes — -F
for multipart form data and -u
for basic auth are both supported.
Is it free?
Yes, no signup, no limits.
I'm building SamToolkit, a growing set of free, privacy-first developer tools that run entirely in your browser. If you've got a tool you wish existed, I'd love to hear about it in the comments.