cURL Converter

Works fully offline Developer

Paste a curl command, for example one copied from your browser's network tab, and get the same HTTP request as ready-to-run code in JavaScript, Python, or Go.

Paste straight from browser DevTools (right-click a request → Copy as cURL), in bash or cmd format.

    

Overview

API documentation and browser DevTools both speak curl: every network request in Chrome, Edge, and Firefox can be copied as a curl command. Turning that into application code by hand means carefully translating every header, the request body, authentication, and quoting rules, and it's easy to drop a header or mangle an escaped quote.

This converter reads the command the way a shell would. It understands single and double quotes, bash's $'…' strings, line continuations, and the caret escapes in Windows cmd exports. It then maps curl options onto the target library: -H headers, -d, --data-raw, and --json bodies, -F multipart forms and file uploads, -u basic authentication, -b cookies, -G query strings, and -k for skipping TLS verification.

JSON bodies become real objects in the output (JSON.stringify for fetch, json= for Python requests) rather than opaque strings, so they're easy to edit. Options that have no equivalent in generated code, such as --compressed or -v, are ignored, and any flag the converter doesn't recognise is listed so nothing is silently lost.

Examples & Sample Data

A JSON POST copied from DevTools, to fetch

Input
curl 'https://api.example.com/v1/orders' -H 'authorization: Bearer abc.def' --json '{"sku":"A1","qty":2}'
Output
const response = await fetch('https://api.example.com/v1/orders', {
  method: 'POST',
  headers: {
    'authorization': 'Bearer abc.def',
    'Content-Type': 'application/json',
    'Accept': 'application/json',
  },
  body: JSON.stringify({
    "sku": "A1",
    "qty": 2
  }),
});

const data = await response.json();

A file upload, to Python requests

Input
curl -F 'title=Report' -F '[email protected]' https://example.com/upload
Output
import requests

data = {
    'title': 'Report',
}

files = {
    'file': open('report.pdf', 'rb'),
}

response = requests.post('https://example.com/upload', data=data, files=files)

How It Works

  1. Copy a curl command, for example from DevTools by right-clicking a request and choosing Copy as cURL.
  2. Paste it into the input box. Multi-line commands with backslash or caret continuations work as-is.
  3. Choose JavaScript fetch, Axios, Python requests, or Go net/http.
  4. Copy the generated code. Check the note under the input for any curl options that had no equivalent.

Common Use Cases

Reproducing a browser request in code

Copy a request from the network tab and turn it into a script to automate or debug an API call.

Using API documentation examples

Translate the curl examples in API docs into the language your project uses.

Writing an integration test

Start a test from a known-good request by converting the exact curl command that worked.

Tips & Best Practices

  • A command copied from DevTools includes your cookies and authorization headers. Remove secrets before sharing the generated code.
  • For file uploads, the generated JavaScript expects a file input named fileInput. Replace it with wherever your file comes from.
  • DevTools copies many headers the server doesn't need, such as sec-ch-ua and priority. You can usually delete them from the output.

Frequently Asked Questions

No. Parsing and code generation run entirely in your browser, which matters because copied commands often contain tokens and cookies.

Request method, headers, all -d/--data variants, --data-urlencode, --json, -F forms and file uploads, -u authentication, -b cookies, -A user agent, -e referer, -G, -I, and -k. Output-only options like -s, -v, -o, and --compressed are ignored, and unrecognised flags are listed.

Yes. The caret escapes and line continuations Chrome uses for cmd are handled, as are bash's quoting rules and $'…' strings.

curl sends POST whenever a body is given with -d, --json, or -F and no -X method is set. The generated code does the same, and -G switches it back to GET with the data in the query string.

Related Tools

Explore more high-performance utilities.