Start a project

Tool 64 of 100 · API

cURL Converter

Paste a curl command from API docs or your browser's network tab and get the same request in JavaScript, Python, Go, PHP, HTTPie or PowerShell.

cURL Converter at a glanceIllustration: 1, A curl command; 2, processed in your browser; 3, Code in six languages.cURL Converter$ curl -X→ fetch()1A curl command</>3Code in six languages2In yourbrowser
1 A curl command 2 processed on your device 3 Code in six languages

cURL Converter

curl command

PartValue

    Code

    Converted code

    01

    What it does

    Parses a curl command like a shell would and rewrites it as fetch, Python requests, Go, PHP, HTTPie or PowerShell.

    • Shell-accurate parsing: quotes, escapes and line continuations
    • Headers, cookies, basic auth and bearer tokens
    • JSON, form and multipart bodies
    • fetch, Python requests, Go, PHP, HTTPie and PowerShell

    02

    Private by design

    Everything happens in your browser. Nothing you type, paste or upload is sent anywhere, and it keeps working offline once the page has loaded.

    03

    What you get

    Code in six languages, with a Copy and a Download button on every result.

    • cURL
    • fetch
    • Python
    • API

    Why it matters

    API docs give examples as curl commands, and browsers can copy any request as curl. Turning that into code means translating quoting, headers, auth and body flags by hand, and a missed escape breaks the request.

    This converter parses the command the way a POSIX shell does, then writes idiomatic code for the language you pick. Nothing is sent: it only converts, so commands with real tokens stay on your device (still, rotate any token you've pasted somewhere public).

    How it works

    1. InputA curl command, e.g. Copy as cURL
    2. In your browserParsed like a shell, every flag mapped
    3. Outputfetch, Python, Go, PHP, HTTPie or PowerShell

    Where it fits in a designer's workflow

    1. Plan
    2. Design
    3. Build
    4. Test
    5. Launch
    Turning a request from the browser into code.

    By the numbers

    The sample curl command converted to each languageJavaScript fetch: 16 lines; Python requests: 17 lines; Go net/http: 33 lines; PHP cURL: 21 lines; HTTPie: 7 lines; PowerShell: 13 linesJavaScript fetch16 linesPython requests17 linesGo net/http33 linesPHP cURL21 linesHTTPie7 linesPowerShell13 lines
    Counted from this tool's own output. Headers, the JSON body, auth and redirects carry across; Go is longest because its standard library makes every step explicit. Source: curl manual.
    Show the numbers as a table
    LanguageLines
    JavaScript fetch16
    Python requests17
    Go net/http33
    PHP cURL21
    HTTPie7
    PowerShell13

    How to use it

    1. Paste a curl command, including line breaks with backslashes.
    2. Pick the language you want.
    3. Check the table of method, URL, headers and body.
    4. Copy or download the code.

    FAQ

    Does it run the request?

    No. It only converts the command, so no request is made.

    Which curl options are understood?

    The common ones: -X, -H, -d and --data-*, --json, -F, -u, -b, -A, -e, -L, -k, -I, -G and --compressed. Others are listed as ignored.

    Is 'Copy as cURL' from Chrome supported?

    Yes, including the bash format with $'…' quoting.

    Is my token safe?

    It stays in your browser. Treat tokens in commands as secrets anyway, and use the masked placeholder in docs.

    Work with me

    Want a site that gets these right?

    I build fast, accessible websites and web apps that pass these checks from day one. Tell me about your project and I'll reply personally with honest next steps.

    All developer tools · Back to leej.uk