cURL Command Converter

Turn a curl command into JS, Python, PHP, Go, or Ruby code, ready to paste in.

Runs in your browserNo sign-up required
Paste a cURL Command
Method: POSTURL: https://api.example.com/usersHeaders: 2
Output
fetch('https://api.example.com/users', {
  method: 'POST',
  headers: {
    "Content-Type": "application/json",
    "Authorization": "Bearer YOUR_TOKEN"
  },
  body: "{\"name\":\"John Doe\",\"email\":\"john@example.com\"}"
})
  .then((res) => res.json())
  .then(console.log);

From API Docs Straight Into Your Codebase

Most API documentation shows a curl example first, but the actual project might be written in JavaScript, Python, or something else entirely. This tool bridges that gap — paste the curl command as-is, pick your language, and get working code with the same method, headers, and body already filled in.

How to Use This Tool

  1. 1Paste a curl commandCopied straight from API documentation, a browser's "Copy as cURL", or anywhere else.
  2. 2Pick a target languageJS fetch, Axios, Python requests, PHP, Go, or Ruby.
  3. 3Copy the generated codeReady to drop directly into your project.

Good to Know

  • Browser DevTools has a "Copy as cURL" option on any network request — a quick way to grab a real, working curl command for any request a page makes, which this tool can then translate into your own project's language.
  • Headers, the request method, and the request body (-d/--data) are all picked up automatically from the pasted command.
  • Basic auth (-u user:pass) is recognized but not yet translated into every target language's idiomatic auth syntax — check the generated code's headers section if you used it.
  • This only translates the request itself — nothing is actually sent anywhere by this tool.

Frequently Asked Questions

Where do I usually get a curl command to convert?

API documentation almost always includes a curl example first, and browser DevTools' Network tab lets you right-click any request and "Copy as cURL" — both are common sources this tool is built to handle.

Does it support every curl flag?

The commonly-used ones — method (-X), headers (-H), body (-d/--data/--data-raw), and basic auth (-u). More obscure flags (client certificates, custom timeouts) aren't parsed, since they rarely appear in the API-doc-style commands this tool targets.

Can I go the other direction, from code back to curl?

Yes — the API Request Tester builds a request visually and can export it as a curl command alongside the other language options, covering that reverse direction.

Is this free to use?

Yes, completely free, with no limit on how many commands you convert.