Skip to content
DevToolKits

cURL Converter

Convert a cURL command into code for Python (requests), Node.js (node-fetch), JavaScript (fetch), Go, Rust, PHP, Java, R, Elixir or Dart. You can also read the request contents (method, URL, headers, cookies, authentication and body) as JSON. In Chrome or Edge DevTools, right-click a request in the Network tab and choose Copy as cURL, then paste it here to get code that reproduces the browser request. The main options for calling APIs are supported, including headers, method, data, forms, Basic authentication and cookies; options it cannot interpret are shown as an error. No request is actually sent, and conversion happens entirely in your browser. The output has no timeouts or error handling, so use it as a starting point.

Formats the command with one option per line, or masks tokens, cookies, passwords and API keys with *** so you can share it. Both replace the command above; check the result before you paste it anywhere.

Copied!
Guide

How to use & features

  • Paste your cURL command (e.g., curl -X POST ...) into the input box.
  • Select your target programming language from the "Output Language" dropdown.
  • Copy the generated snippet directly into your application code.
Samples

Sample input & output

Convert POST request to Python

Input
curl -X POST https://api.example.com/login -d 'username=test&password=pass'
Output
import requests

data = {
    'username': 'test',
    'password': 'pass',
}

response = requests.post('https://api.example.com/login', data=data)
FAQ

FAQ

  • Which languages can it convert to?

    Ten languages: Python (requests), Node.js (node-fetch), JavaScript (fetch), Go, Rust, PHP, Java, R, Elixir and Dart, plus a JSON form of the request contents.
  • How do I get a cURL command from the browser?

    In Chrome or Edge, open DevTools, go to the Network tab, right-click the request and choose Copy → Copy as cURL. Paste it here and the headers and cookies are converted along with it.
  • Which options does it support?

    The main options for calling APIs: headers (`-H`), method (`-X`), data (`-d`, `--data-raw`), forms (`-F`), Basic auth (`-u`), cookies (`-b`) and more.
  • Does this tool actually send the request?

    No. It only rewrites the cURL command text as code. No request is made and what you paste is not sent anywhere.
  • Will the converted code run as is?

    Often yes, but libraries such as `requests` and `node-fetch` must be installed separately. Replace values such as tokens with those of your real environment.
Use cases

Common use cases

  • Reproducing a browser request as a script

    Paste DevTools' "Copy as cURL" output to get Python, JavaScript or other code that sends the same request.
  • Converting cURL examples in API docs to your language

    Turn the `curl` examples in documentation into code in the language you use, as a starting point for your implementation.
  • Attaching reproduction code to a bug report

    Convert the steps from cURL to code and paste it into an issue or internal ticket.
  • Reading a request's contents as JSON

    Choose JSON to get the method, URL, headers and body in a structured form that is easy to read.
Notes

Notes & limitations

  • Be careful with cURL that contains credentials

    Copied cURL can include tokens, cookies or API keys. Conversion runs in your browser and nothing is sent out, but do not commit the output to a repository or paste it into chat as it is.
  • Some options are not supported

    Not every curl option can be converted. Options it cannot interpret are ignored or shown as "Error:".
  • Use the generated code as a starting point

    It does not include timeouts, retries, error handling or TLS certificate verification. Add what you need before using it in production.
  • Per-language libraries must be installed separately

    The Python output uses `requests` and the Node.js output uses `node-fetch`. Install them in your own environment.
About

About this tool

cURL Command to Code Converter

Automatically convert cURL commands—often copied from browser developer tools or API documentation—into ready-to-run HTTP request code in languages like TypeScript (fetch/axios), Python (requests), Go, Rust, PHP, and more.

Streamlining API Integrations

Integrating third-party APIs is unavoidable in modern application development. By pasting a known-working HTTP request into this tool, you instantly receive the exact native scripting code, complete with properly mapped authentication headers, cookies, and JSON body payloads.
This drastically reduces boilerplate coding, eliminates string-escaping typos, and accelerates both frontend feature delivery and automated testing script generation.

Common workflows

  • From DevTools to code: Copy a request as cURL from browser developer tools and convert it into fetch, Python, Go, or another language.
  • From docs to scripts: Turn API documentation examples into runnable test scripts.
  • From terminal debugging to automation: Reuse a verified cURL command inside integration tests, CLI tools, or backend jobs.

Security note

cURL commands often contain Authorization, Cookie, API keys, and session headers. Remove secrets before sharing generated code, committing snippets, or pasting examples into public tickets.

Articles for this tool

Recent Articles