Developer tools

cURL to code

Convert a cURL request into JavaScript fetch, Python requests or PHP cURL code.

cURL to code
Esc to restore

Your inputs

Up to 200,000 characters. Source is processed locally and never executed.

Results update as you type. Larger files run when you press Update result.

Your result

Your result will appear here.

Sensitive results stay in this page’s memory. Take care when copying or downloading them.

Your inputs stay in this browser. Nothing is uploaded or saved.

A clear answer. Here’s how.

Parses one HTTP/HTTPS cURL command with POSIX quoting and line continuations. Supports -X/--request, -H/--header, -d/--data, --data-raw, --data-binary, --data-urlencode, --json, -u/--user, --url, -G/--get, -I/--head and -L/--location. Body data defaults to POST; --get moves it to the query. Preserves redirect choice. Basic auth is ASCII user:password. Repeated headers, file reads, multipart uploads, shell variables/substitutions, operators and unsupported options are refused instead of silently dropped. The generated request is never run. Browser fetch remains subject to CORS and forbidden headers; browser credentials and cookies can differ from cURL. Python requires requests and PHP requires its cURL extension. Up to 200,000 characters.

How this is checked

2 reference checks passed These 2 cases were run when this page was built, on 3 December 2026, and all reproduce within the stated tolerance. The same cases are part of the automated tests that run on every change to Toolmoz. Engine version 1.

See the checks and where each expected answer comes from
  1. Case 1

    Inputs
    Source curl 'https://example.com/'
    Expected, and what Toolmoz gave
    text expected const response = await fetch("https://example.com/", { "method": "GET", "headers": {}, "redirect": "manual" }); console.log(await response.text()); , Toolmoz const response = await fetch("https://example.com/", { "method": "GET", "headers": {}, "redirect": "manual" }); console.log(await response.text());
    Where the expected answer comes from
    A URL-only cURL request uses GET by default.
    Allowed difference
    exact
  2. Case 2

    Inputs
    Source curl 'https://example.com/' -d 'a=1'
    Expected, and what Toolmoz gave
    text expected const response = await fetch("https://example.com/", { "method": "POST", "headers": { "Content-Type": "application/x-www-form-urlencoded" }, "redirect": "manual", "body": "a=1" }); console.log(await response.text()); , Toolmoz const response = await fetch("https://example.com/", { "method": "POST", "headers": { "Content-Type": "application/x-www-form-urlencoded" }, "redirect": "manual", "body": "a=1" }); console.log(await response.text());
    Where the expected answer comes from
    cURL --data changes the default request method to POST.
    Allowed difference
    exact

What this shows: the engine reproduces independently worked values for these cases. It does not prove every possible input is right. To test an answer you were given, see how to check a number; to see what is and is not checked across Toolmoz, see the accuracy ledger.