Skip to content

Convert curl commands to your favorite programming language

A curl command packs a request into one line: method, URL, headers, body and options.

OUTPUT FORMATSHTMLJSONMarkdown

Moving that request into application code usually means retyping each piece in a different syntax. This hub points you to the converter for your target language or library, so you can paste a curl command and get a matching request you can drop into your project.

How the converter works

You choose a target language or library, paste a curl command, and the converter rewrites the request in that target's syntax. The output covers the request method, URL, headers and body. What changes between targets is how each one expresses those pieces: a Python requests call, a JavaScript fetch call, a Go http request, and a JSON object all describe the same request in different shapes.

Pick your target

Each supported language or library has its own converter page. Use the table below to jump to the one that matches your project. If you are unsure, start with the language you will actually run the request in — the output is easier to verify when you can execute it.

Before you convert: a quick checklist

A conversion is only as good as the curl command you paste. Check these items first:

  • Method: is it GET, POST, PUT, PATCH or DELETE? A bare curl with no -X flag is a GET.
  • Headers: list every -H flag, especially Content-Type and Authorization.
  • Body: confirm whether -d, --data-binary or --data-raw is used, and whether the body is JSON, form data or raw text.
  • Quoting: shell quoting around JSON bodies often needs adjustment when the command is pasted into another tool.
  • Auth: note whether credentials sit in a header, a cookie or a URL parameter.

If any of these are missing from the curl command, the converted request will be missing them too.

Reading a curl command before converting

Take a simple example: a POST to an API endpoint with a JSON body and an Authorization header. The curl command has three parts to carry over — the method and URL, the two headers, and the body string. When you convert it, check that the output has the same method, the same URL, both headers and the same body. If the target language requires a different content type or wraps the body in a library-specific object, that is expected; the underlying request should still match.

Conversion errors vs. request errors

Two different things can go wrong. A conversion error means the output does not faithfully represent the curl command — a dropped header, a mangled body, a wrong method. A request error means the converted code runs but the server rejects or fails the request — a 401, a 400, a timeout. Fix conversion errors by comparing the output against the original curl command line by line. Fix request errors by checking credentials, endpoint availability and payload format, the same way you would debug any HTTP call.

Supported conversion targets
TargetTypical use caseConverter page
CFMLColdFusion applicationsCFML converter
DartFlutter and Dart appsDart converter
ElixirElixir servicesElixir converter
GoGo services and CLIsGo converter
JavaJVM applicationsJava converter
JavaScript FetchBrowser and modern JSJavaScript Fetch converter
JSONData-only request descriptionJSON converter
MATLABScientific and engineering scriptsMATLAB converter
NodeJS with AxiosNode apps using AxiosNode Axios converter
NodeJS with fetchNode apps using native fetchNode fetch converter
NodeJS with RequestLegacy Node apps using RequestNode Request converter
PHPPHP web applicationsPHP converter
PythonScripts and data workPython converter
RStatistical analysisR converter
RustRust services and toolsRust converter

Target list reflects the converters offered on this hub. Library-specific output depends on the target page you choose.

Frequently asked questions

Which languages can I convert a curl command to?

The hub links to converters for CFML, Dart, Elixir, Go, Java, JavaScript Fetch, JSON, MATLAB, NodeJS with Axios, NodeJS with fetch, NodeJS with Request, PHP, Python, R and Rust.

Do I need to install anything to use the converter?

No. The converters run in the browser: paste the curl command, choose a target, and copy the output.

Why does my converted request fail when the curl command worked?

The most common causes are a missing header, a body that was reformatted during conversion, or credentials that were in the shell environment rather than in the curl command itself. Compare the converted code against the original command field by field.

Can I convert a curl command that uses cookies or authentication?

Yes, as long as the credentials appear in the curl command as headers, cookies or URL parameters. Credentials that were supplied by shell variables or a .netrc file will not be carried over automatically.