# cURL Converter

> Turn any curl command into fetch, Python, Go, PHP, or Rust.

Free curl converter. Paste a curl command and get equivalent code for JavaScript fetch, Python requests, Go net/http, PHP cURL, and Rust reqwest. Headers, bodies, basic auth, and common flags are translated automatically.

- Page: https://benchline.fabwaseem.com/t/curl-converter
- Runs: in the browser. Input stays on the device.
- Price: free, no account
- Input: A curl command and the target language.
- Output: An equivalent code snippet plus the parsed request and warnings.
- Keywords: curl to python, curl to javascript, curl converter, curl to fetch, curl to go
- Updated: 2026-10-18
- Built by: Waseem Anjum (https://fabwaseem.com)

## How to use it

1. **Paste the curl command.** Drop in a curl command, including multi-line ones with backslash continuations.
2. **Pick the target.** Switch between fetch, Python, Go, PHP, and Rust tabs.
3. **Copy the snippet.** Each tab has copy and download buttons. Check the warnings for ignored flags.

## Use it from an AI agent

MCP tool name: `convert_curl`
MCP endpoint: https://benchline.fabwaseem.com/mcp (Streamable HTTP, no key)
HTTP: POST https://benchline.fabwaseem.com/api/v1/tools/curl-converter with the input as the JSON body
This call does not fetch anything. It runs on the arguments you send.

Parse a curl command and generate equivalent JavaScript fetch, Python requests, Go, PHP, or Rust code.

### Input schema

```json
{
  "type": "object",
  "properties": {
    "command": {
      "type": "string",
      "minLength": 1,
      "maxLength": 20000
    },
    "target": {
      "default": "fetch",
      "type": "string",
      "enum": [
        "fetch",
        "python",
        "go",
        "php",
        "rust"
      ]
    }
  },
  "required": [
    "command",
    "target"
  ],
  "additionalProperties": false
}
```

### Example tools/call

```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "convert_curl",
    "arguments": {
      "command": "example",
      "target": "fetch"
    }
  }
}
```

Setup for Claude, Cursor, and VS Code: https://benchline.fabwaseem.com/mcp/guide

## Questions

### Which curl flags are supported?

-X/--request, -H/--header, -d/--data variants, -u/--user, -A/--user-agent, -b/--cookie, -k/--insecure, -L/--location, and --compressed. Anything else is listed as ignored.

### How is the HTTP method chosen?

An explicit -X flag wins. Otherwise a command with a body becomes POST and one without becomes GET.

### What happens to -u basic auth?

It becomes auth=(user, pass) in Python, SetBasicAuth in Go, CURLOPT_USERPWD in PHP, .basic_auth in Rust, and an Authorization header in fetch.

### Is my command sent anywhere?

No. Parsing and code generation run entirely in the browser on this page.

## Related tools

- [HTTP headers](https://benchline.fabwaseem.com/t/http-headers-checker): Follow redirects and grade the security headers on a public URL.
- [URL encoder and parser](https://benchline.fabwaseem.com/t/url-codec): Encode or decode a URL, then break the query string into parameters.
- [JSON formatter](https://benchline.fabwaseem.com/t/json-formatter): Pretty-print, minify, and validate JSON, with the exact line and column when it fails.
- [GraphQL Client](https://benchline.fabwaseem.com/t/graphql-client): Query any GraphQL endpoint with variables, headers, and history.
