Recuro.

cURL to Code Converter

Convert curl commands to JavaScript, Python, PHP, or Axios code instantly.

Processed entirely in your browser — no data sent to any server.

Already have the cURL command?

Turn it into a scheduled job on Recuro. Paste the URL, set a cron expression, and we handle the rest.

Get started free

How this curl converter works

cURL is the command-line tool installed on every major operating system for making HTTP requests. When you read API documentation or copy a request from browser DevTools, the example is almost always a curl command. This curl to code converter parses those commands and generates clean, idiomatic code you can drop straight into your project.

The converter supports four target languages. Convert curl to JavaScript using the native fetch API for browser and Node.js projects. Convert curl to axios for Node.js projects that use the axios library. Convert curl to Python requests — the standard HTTP library for Python. And convert curl to PHP using the native curl_* functions.

It works as a curl to REST API converter too — paste any curl command from an API's documentation and get production-ready code that matches the exact endpoint, headers, authentication, and request body. Common flags include -X for the HTTP method, -H for headers, -d for request body data, and -u for basic authentication. If no -X flag is present, the method defaults to GET — or POST if a -d flag is included.

To get a curl command from your browser: open DevTools (F12), go to the Network tab, right-click any request, and select "Copy as cURL." Paste it here and select your language — the curl converter handles the rest.

Need to schedule these HTTP requests on a cron schedule? Recuro lets you configure endpoints with headers, body, and cron expressions — no server required.

Supported curl conversions

This curl converter supports the following target languages and libraries:

  • Curl to JS fetch — uses the native fetch() API available in all modern browsers and Node.js 18+. No dependencies needed.
  • Curl to axios — generates code using the axios npm package with built-in JSON parsing, auth helpers, and interceptor support.
  • Curl to Python requests — generates code using the requests library with proper headers dict, json/data parameters, and auth tuples.
  • Curl to PHP — generates native PHP code using curl_init(), curl_setopt(), and curl_exec() — no framework required.

All conversions handle the most common curl flags: -X / --request (HTTP method), -H / --header (custom headers), -d / --data / --data-raw (request body), and -u / --user (basic authentication). JSON bodies are auto-detected and formatted cleanly in the output.

Frequently Asked Questions

How do I convert curl to JavaScript?

Paste your curl command into the input field and select "JS fetch" to convert curl to JavaScript using the native fetch API. The converter handles -X (method), -H (headers), -d (body), and -u (basic auth) flags automatically. For Node.js projects that prefer axios, select "Node axios" to convert curl to axios code instead.

How do I convert curl to Python requests?

Select the "Python" tab and paste your curl command. The tool converts curl to Python requests code, mapping -H flags to the headers dict, -d to the json or data parameter, and -u to the auth tuple. The generated code uses the requests library, which is the standard for making HTTP calls in Python.

How do I convert curl to PHP?

Select the "PHP" tab and paste your curl command. The tool generates PHP code using the native curl_* functions (curl_init, curl_setopt, curl_exec). It maps all common flags including custom headers, request body, HTTP method, and basic authentication.

Does this curl converter handle all flags?

This curl converter supports the most common flags: -X (method), -H (headers), -d and --data-raw (request body), -u (basic auth), and URL detection. Obscure flags like --cert, --proxy, or --compressed are not currently supported. For most REST API curl commands, this covers what you need.

Is it safe to paste curl commands with auth tokens?

Yes — this curl to code converter processes everything entirely in your browser. No data is sent to any server. Your tokens, API keys, and credentials stay on your machine. That said, be cautious about sharing the generated code in public places if it contains sensitive values.

How do I get a curl command from my browser?

In Chrome or Firefox, open DevTools (F12), go to the Network tab, right-click any request, and select "Copy as cURL". This gives you a complete curl command with all headers, cookies, and body data that you can paste directly into this curl converter.

What is the difference between curl to fetch and curl to axios?

Both convert curl to JavaScript, but they target different libraries. "JS fetch" generates code using the browser-native fetch API — no dependencies required. "Node axios" generates code using the axios library, which provides built-in JSON parsing, request/response interceptors, and automatic error handling for non-2xx responses. Use fetch for simple requests and axios for projects that already depend on it.

⌘Enter to run  ·  ⌘⇧C to copy

Next steps