cURL to Code Converter

Paste a cURL command and get matching request code in TypeScript, Python, Go or Rust, ready to copy into your project.

About cURL to Code Converter

This converter reads a cURL command and rewrites it as code you can run in your own project. It picks up the URL, the method set with -X, headers set with -H and a request body set with -d. Choose a target language to see the output: TypeScript using fetch, Python using the requests library, Go using the standard net/http package, or Rust using reqwest.

The TypeScript and Python output include the headers and JSON body; the Go and Rust output currently set up the method and URL only, so add headers and the body by hand. A typical use is copying a request from your browser's developer tools as cURL and turning it into a starting point for a script or test. Conversion happens in your browser.

How to use it

  1. Paste a cURL command into the input box.
  2. Choose TypeScript, Python, Go or Rust.
  3. Review the generated request code.
  4. Click Copy Code and paste it into your project.

Questions

Which cURL options are understood?

The URL, -X for the method, -H for headers and -d for the request body. Other options are ignored.

Why are headers missing in the Go or Rust code?

The Go and Rust templates currently include only the method and URL. Add headers and the body manually after copying.

More Developer & Code tools

Home · All Tools · Blog