Developer Utility Tools

cURL to Code Converter

Paste a curl command, for example from your browser's developer tools (Copy as cURL) or API documentation, and get equivalent code in more than 40 languages and libraries: Python requests, JavaScript fetch, Axios, PHP Guzzle, Go, Java, C#, Ruby, Rust, PowerShell, HTTPie and more.

Private by design: anything you enter is processed in your browser only. It is never uploaded to or logged on our servers. The command is parsed locally, so tokens and cookies in it stay on your device. No request is sent to the URL.

Examples:

Bash syntax (quotes, \ line continuations, $'…'). Windows ^ continuations from Chrome's "Copy as cURL (cmd)" are converted automatically.

About the cURL to Code Converter

curl is the lingua franca of HTTP: API documentation shows requests as curl commands, and every browser's developer tools can copy a request "as cURL" with all of its headers, cookies and body. Turning that command into code by hand is tedious and easy to get wrong, especially quoting, form encoding and multipart uploads. This converter does it for you.

It is built on the open-source curlconverter project. The command is parsed with a real Bash grammar (tree-sitter), so single and double quotes, $'…' strings and backslash line continuations are understood the same way your shell would. curl's option parser is reimplemented too, so short options can be combined (-sSL) and long options abbreviated.

When the target library cannot express part of the command, for example a curl option with no equivalent, a file that is read from disk, or several URLs in one command, the converter still produces code and lists what was dropped under Warnings. Review them before you ship the generated code.

The generated code includes every header from the command. Requests copied from a browser contain session cookies and tokens: remove the ones you do not need and never commit real credentials. To look at a token in the command, use the JWT decoder; to inspect a JSON response, try the JSON beautifier or compare two responses with the JSON diff tool.

Reference Guide

curl options most often seen in copied commands, and how they are converted:

OptionMeaningIn generated code
-X, --requestHTTP methodMethod argument (GET is implied, POST when there is a body)
-H, --headerRequest headerHeaders map / object
-d, --data, --data-rawRequest body (form-encoded unless a Content-Type is set)Body string, form data or a JSON object when the body is JSON
--data-urlencodeURL-encoded form fieldForm field, encoded by the library
-F, --formmultipart/form-data field or file (@file)Multipart body with a file reader
-G, --getSend -d data as the query stringQuery parameters
-u, --userBasic authenticationLibrary auth helper or an Authorization header
-b, --cookieCookiesCookie map or Cookie header
-k, --insecureSkip TLS certificate verificationVerification disabled (avoid in production)
-L, --locationFollow redirectsRedirect option where the library needs one
--compressedAsk for gzip/brotli and decompressUsually implicit

Example input

curl -X POST https://api.example.com/v1/users \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -d '{"name": "Ada Lovelace", "email": "ada@example.com", "roles": ["admin"]}'

This sample loads automatically when you open the tool. Use Load Sample to bring it back.

Frequently Asked Questions

Open the developer tools (F12), go to the Network tab, right-click the request and choose Copy > Copy as cURL (bash). Paste it here and pick the language you need. The cmd variant from Windows is converted automatically.

More than 40 targets, including Python requests, JavaScript fetch, Axios and other Node.js clients, PHP cURL and Guzzle, Go, Java, Kotlin, C#, Ruby, Rust, Swift, Dart, PowerShell, HTTPie, wget, Ansible, raw HTTP, HAR and JSON.

Some curl options have no equivalent in the chosen library, or the command does something the generated code does not, such as sending several URLs or reading a file. The code is still generated and each warning tells you what was left out so you can add it by hand.

No. The command is parsed and converted in your browser and no request is made to the URL. Remember to remove real tokens and session cookies from the generated code before you share or commit it.

The parser follows curl's own option list, so a typo or an option from a different tool is rejected. Check the spelling, or remove the option if it is not a curl flag.