Conversion Tools

cURL Converter

Convert cURL commands to JavaScript, Python, Java, PHP, C#, Ruby, Rust, Go, Swift, Kotlin, PowerShell, Axios, or HTTPie code.

Your data never leaves your browser — nothing is sent to any server.

Converted code will appear here...
How to use
  1. 1

    Paste your cURL command

    Copy a cURL command from browser DevTools, Postman, or documentation and paste it into the left panel. Multi-line commands with \ continuations are supported.

  2. 2

    Choose an output format

    Select your target language from the tabs: JavaScript, Axios, Python, Java, PHP, C#, Ruby, Rust, Go, Swift, Kotlin, PowerShell, or HTTPie. The output updates instantly.

  3. 3

    Review and copy the code

    Check that headers, method, and body match your intent. Click the copy button to paste the generated code into your project.

  4. 4

    Try the example

    Click Load example to see a sample POST request with JSON body and authorization header converted to each format.

Common errors

Command must start with curl

Ensure the pasted text begins with curl. Some tools export wget or httpie commands — this converter only accepts cURL syntax.

Could not find a URL in the cURL command

The command must include an http:// or https:// URL. Check that the URL wasn't truncated when copying, especially on multi-line commands.

Missing header value after -H

Each -H flag needs a quoted header like -H 'Content-Type: application/json'. Fix the cURL syntax and try again.

FAQ (5)
What does the cURL converter do?

It parses a cURL command copied from browser DevTools, API docs, or terminal history and converts it into equivalent code for JavaScript fetch, Axios, Python requests, Java HttpClient, PHP cURL, C# HttpClient, Ruby Net::HTTP, Rust reqwest, Go net/http, Swift URLSession, Kotlin OkHttp, PowerShell Invoke-RestMethod, or HTTPie. Headers, method, body, cookies, and basic auth are preserved.

How do I copy a cURL command from Chrome DevTools?

Open DevTools → Network tab, right-click a request, and choose Copy → Copy as cURL (bash). Paste the result into the input panel. The converter handles multi-line commands with backslash continuations.

Which cURL flags are supported?

Common flags are supported: -X (method), -H (headers), -d / --data (body), -F (form fields), -b (cookies), -u (basic auth), -L (follow redirects), and -k (insecure). Less common flags are ignored rather than causing errors.

Is the generated code production-ready?

The output is a starting point that mirrors your cURL request. You may need to add error handling, environment variables for secrets, and library-specific configuration before using it in production. Never hard-code API tokens in committed code.

Is my cURL command sent to a server?

No. Parsing and code generation run entirely in your browser. Your URLs, headers, tokens, and request bodies never leave your device.

Learn more

cURL Converter — Turn cURL Commands into Code

cURL is the lingua franca of HTTP debugging. Every browser, API client, and documentation example can export requests as cURL commands. But when you need to reproduce that request in your application, rewriting it by hand is tedious and error-prone. This converter parses your cURL command and generates equivalent code for popular HTTP libraries — instantly, in your browser.

Supported Output Formats

Choose from JavaScript fetch, Axios, Python requests, Java HttpClient (Java 11+), PHP cURL, C# HttpClient, Ruby Net::HTTP, Rust reqwest, Go net/http, Swift URLSession, Kotlin OkHttp, PowerShell Invoke-RestMethod, and HTTPie. Each generator preserves the HTTP method, URL, headers, request body, cookies, and basic authentication from your original cURL command.

From DevTools to Production Code

The most common workflow: reproduce a failing API call in the browser, copy it as cURL from the Network tab, paste it here, and get a fetch, Python, Java, or PHP snippet to drop into a script or test. This eliminates manual transcription of long Authorization headers, Content-Type values, and JSON payloads.

Language-Specific Notes

Java output uses the standard java.net.http.HttpClient API. PHP output uses the native curl extension with curl_setopt. C# uses HttpRequestMessage for flexible method support. Rust output requires the reqwest and tokio crates. Kotlin output uses OkHttp — add the OkHttp dependency to your Gradle build. PowerShell output uses Invoke-RestMethod for Windows automation and Azure scripts.