cURL to code
Convert a cURL request into JavaScript fetch, Python requests or PHP cURL code.
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
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
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.