cURL Converter

Convert cURL to JSON, JavaScript Fetch or Python Requests locally. Preserve repeated headers, query parameters and raw body text. No request is executed.

cURL Converter

Convert one cURL command into Fetch, Python Requests or Request JSON.

Local conversion only

Paste a cURL command and convert it locally into JavaScript Fetch, Python Requests or a JSON request description. ToolMint does not execute the request or send the command to a server.

One HTTP or HTTPS request. Press Ctrl or Command + Enter to convert.

0 / 65,536

Commands can contain tokens, cookies or signed URLs. Conversion stays in this browser tab, but review generated output before sharing it.

Try JSON POST or a large integer ID. Request JSON keeps body text in a string, including exact number spelling. Examples use fictional data and are never sent.

Output format

JavaScript Fetch

Review warnings before running generated code.

Generated code will appear here

Paste one cURL command, choose an output format and select Convert.

Ready for a cURL command.

Steps

How to use

  1. Paste one cURL command for an HTTP or HTTPS request.
  2. Choose Request JSON, JavaScript Fetch or Python Requests as the output format.
  3. Select Convert and review the parsed request summary and any compatibility warnings.
  4. Copy the generated output or download the .json, .js or .py file.
Examples and use cases
  • Choose Request JSON to inspect repeated headers and query parameters without losing their order.
  • Load the JSON POST example to compare Fetch JSON.stringify with Python json=payload.
  • Load the large-ID example and check that 9007199254740993 remains in the raw request body.
  • Translate a cURL API example with basic authentication into Python Requests.
  • Move cURL data into query parameters with -G while preserving an existing query string.
  • Convert scalar multipart form fields into FormData or a Python files mapping.
Privacy, limits and tool details

Key facts

Best use case
Converting JSON POST requests while preserving unquoted large integer IDs in the raw body
Input
One pasted cURL command for one HTTP or HTTPS request
Outputs
Request JSON (.json), JavaScript Fetch (.js) and Python Requests (.py)
Supported data
Headers, JSON, form-encoded data, scalar multipart fields, query data, basic auth and cookies where representable
Safety model
The command is parsed as inert text and shell control or substitution syntax is rejected
Processing method
Synchronous finite-state parsing and deterministic code generation in the browser
Privacy model
Input and generated output stay in browser memory and are not sent through analytics
Input limit
64 KB per pasted command
Main limitation
Browser Fetch cannot reproduce every cURL behavior, including TLS bypass, unrestricted Cookie headers or local file uploads
Privacy

Privacy and processing

Processing method: A finite-state tokenizer parses the pasted command into a normalized request model, then a deterministic browser-side generator produces Request JSON, JavaScript or Python code without executing the request.

Privacy model: The cURL command, URL, headers, body, credentials and generated output remain in browser memory. ToolMint does not execute the request, contact its destination, save the command to localStorage or send private values through analytics.

Limitations

Limitations

  • Request JSON uses ToolMint field names for inspection. It is not a server response; raw bodies remain strings and query entries are decoded for display.
  • Shell substitutions, variables, pipelines, redirections, command chaining and globbing are rejected instead of interpreted.
  • Local file references, stdin, upload-file, client certificates, proxies, DNS overrides and forced HTTP versions are not converted.
  • Browser Fetch restricts headers such as Cookie, User-Agent and Referer and does not expose a cURL-style TLS certificate bypass.
  • Fetch manual redirects can expose less response detail than cURL because browsers may return an opaque redirect response.
  • Duplicate request headers remain visible in the parsed model, but destination APIs may combine or reject them differently.

Page freshness

Published
Sep 01, 2026
Last updated
Oct 28, 2026
Features

Benefits

Request JSON and code

Inspect an ordered JSON request description or generate JavaScript Fetch and Python Requests code.

Explicit compatibility notes

Redirect, cookie, TLS and header differences are surfaced instead of silently discarded.

Inert parsing

The command is treated as text; shell control and substitution syntax is rejected and nothing is executed.

Private browser workflow

URLs, headers, bodies, credentials and generated code remain in the current tab.

Tips

Pro tips

  • Replace placeholder credentials before running generated code, and never publish real API keys or signed URLs.
  • Review browser-specific warnings when converting Cookie, User-Agent, Referer, redirect or TLS options to Fetch.
  • Keep JSON bodies as raw strings when exact large-number semantics matter.
  • Use one request per conversion; cURL commands containing multiple transfers are intentionally rejected.
Watch out

Common mistakes to avoid

  • Assuming generated code has contacted the API; this converter never executes requests.
  • Expecting browser Fetch to set restricted headers such as Cookie exactly like command-line cURL.
  • Sharing generated code before replacing or removing live credentials.
  • Treating -k as portable to browser Fetch even though browsers do not expose certificate-verification bypass controls.

Sources

Detailed cURL Converter guide

What is the cURL Converter?

ToolMint's cURL Converter translates one pasted cURL command into a JSON request description, JavaScript Fetch or Python Requests code. It parses the command as inert text in your browser, creates a normalized request model, and generates code without executing the request or contacting its destination.

This is useful when API documentation gives you a cURL example but your application needs fetch() or Python's requests library. The converter preserves supported request methods, URLs, headers, literal bodies, query data and authentication details, then calls out behavior that cannot be reproduced exactly.

Can I convert cURL to JSON?

Yes. Choose Request JSON, then Convert, to inspect a JSON description of the request. Copy it or select Download JSON to save curl-request.json. Conversion runs locally and does not contact the URL.

What you need What to do
Describe a cURL request as JSON Choose Request JSON. Review the method, URL, ordered headers and query entries, body, authentication and request options.
Inspect JSON already supplied as a request body In the JSON POST example below, the JSON is the text inside -d's shell quotes. Copy that JSON text into JSON Formatter to inspect it separately. Do not paste the whole cURL command into a JSON editor.
Turn a request into application code Choose JavaScript Fetch or Python Requests and review the generated body and headers.
Obtain a server's JSON response This requires running a request in your own environment. ToolMint does not contact the endpoint and cannot show its response.

A JSON request body is data sent to a server; a JSON response is data received from it. Converting the command does not turn one into the other. The curl manual documents --data request-body behavior. Review the large-ID example before rebuilding JSON containing numeric identifiers, and remove real credentials before sharing either the command or generated code.

What the JSON request description contains

ToolMint's JSON uses its own documented field names for inspection and scripting. It is not a server response or a ready-to-import Postman collection. A receiving application needs to map these fields to its own request format.

Field Meaning
method, url Parsed method and URL, including query data appended by -G. The URL retains its original encoding.
headers Ordered {name, value, inferred} entries. Repeated names remain separate; inferred identifies a header supplied by the parser rather than an explicit -H.
query Ordered, decoded {name, value} entries. Repeated names and empty values remain separate; + decodes as a space. Refer to url for original encoding or a distinction such as flag versus flag=.
body null for no body; {type, raw} for text data; or {type, fields} for ordered scalar multipart fields.
auth, cookies, userAgent, referer Parsed values from the corresponding options, or null when absent. Basic authentication is described separately from explicit Authorization headers.
followRedirects, verifyTls, compressed Descriptions of the parsed request options. They do not execute or configure a network client.
unsupportedOptions Unsupported option names. Their values and behavior are not represented; read the conversion notes.

For example, convert this fictional request:

curl 'https://api.example.com/items?tag=one&tag=two' -H 'X-Trace: first' -H 'X-Trace: second'

The JSON contains both X-Trace header entries and both tag query entries in order. They are lists rather than objects keyed by name, so later values do not overwrite earlier ones. URL decoding is for the query list; use the url string when exact encoded spelling matters. See the URL Standard for query parsing behavior.

Why JSON body text stays a string

Request JSON always stores a text body in body.raw. It does not parse and rebuild that text, even when its content type is JSON. After reading the downloaded outer JSON, body.raw contains the body text produced by the cURL parser. Shell quotes and continuations have already been processed; this is not a copy of the entire original shell command.

This preserves number spelling such as 9007199254740993, 1.2300 or 1e3, whitespace and duplicate JSON member names in the parsed body. An invalid JSON body also remains text; exporting a request description does not validate or repair its body. Escaped quotes in the outer JSON are expected. Use JSON Formatter when you separately want to inspect the body.

Convert a JSON POST with a bearer header

Select Load JSON POST, choose JavaScript Fetch, then Convert. The example is fictional; the tool never contacts its URL.

curl -X POST https://api.example.com/users \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -d '{"name":"Jane","active":true,"note":null}'

The output keeps POST, both headers and the three JSON values. Fetch uses JSON.stringify(...). Switch to Python Requests to see json=payload, with True and None in the Python object. These are request-body values; they are not response parsing instructions. The YOUR_TOKEN placeholder is copied into generated code, so replace it only when running the code in your own environment.

Preserve a large integer ID in the JSON body

Select Load large-ID example and Convert, or paste:

curl -X POST https://api.example.com/events \
  -H 'Content-Type: application/json' \
  --data-raw '{"event_id":9007199254740993,"active":true}'

9007199254740993 exceeds JavaScript's maximum safe integer, 9007199254740991. Converting it to a JavaScript Number can round it to 9007199254740992. ToolMint detects this unquoted integer and keeps the entire original body as a string instead of rebuilding an object.

Output target Expected body output
JavaScript Fetch A raw string containing 9007199254740993, without JSON.stringify(...)
Python Requests data=... containing the same raw JSON text, rather than json=payload
Request JSON body.raw contains the original parsed body string, including the large integer

Keep the Content-Type: application/json header. Python's integers can represent this value; the raw output here avoids losing it during the converter's JavaScript parsing step. Check the generated body and compatibility warning before copying it. This safeguard covers unquoted integer literals outside the safe range; it is not a promise of arbitrary decimal precision or byte-identical serialization for all JSON. If you control the API, string IDs may be appropriate, but changing a number to a string changes the payload type and must match the API contract.

How to convert cURL to Fetch

  1. Paste a single cURL command into the input area.
  2. Choose JavaScript Fetch.
  3. Select Convert.
  4. Review the method, host, header count, body type and compatibility notes.
  5. Copy the JavaScript or download curl-to-fetch.js.

The generated code omits unnecessary options for a simple GET. POST, PUT, PATCH, DELETE, HEAD and safe custom methods include the method explicitly. JSON bodies use JSON.stringify() only when parsing and re-serialization will not change value semantics.

How to convert cURL to Python Requests

Choose Python Requests before converting. The generator imports requests, assigns the URL, and uses requests.get(), requests.post() or another convenience method when appropriate. A valid custom method uses requests.request().

Only required arguments are emitted. Depending on the command, these can include headers, json, data, files, auth, cookies, allow_redirects and verify. The converter creates code; it does not run Python or install Requests for you.

Supported cURL options

The first version focuses on common HTTP request options:

  • -X and --request for standard or syntactically valid custom methods
  • -H and --header, including repeated headers
  • -d, --data, --data-raw, --data-binary and --data-urlencode for literal data
  • -F and --form for scalar text fields
  • -u and --user for basic authentication
  • -b and --cookie for simple cookie strings
  • --url, --user-agent and --referer
  • -L, --head, -G, --insecure and --compressed

The tokenizer understands single and double quotes, common escaped characters, Bash backslash line continuations, and a narrow CMD caret continuation. It accepts one HTTP or HTTPS transfer at a time.

What cannot be converted exactly

The converter rejects shell substitutions, variables, pipelines, redirections, command chaining and globbing instead of interpreting them. It also does not convert local file or stdin references, uploads, client certificates, proxy settings, forced HTTP versions, --resolve, --connect-to, DNS overrides or non-HTTP protocols.

These limits are intentional. A browser cannot safely read an arbitrary local path from pasted text, and generated code should not pretend that browser security controls match a command-line client.

Headers and authentication

Repeated cURL headers remain separate in the normalized request model. JavaScript uses the Headers interface when duplicates need to be represented, while Python includes a warning because a normal Requests header mapping cannot preserve duplicate names faithfully.

Authorization headers are preserved. Basic authentication supplied with -u becomes a Basic header in Fetch and an auth tuple in Python. Bearer tokens, API-key headers, cookies, signed URLs and user credentials can be sensitive, so the tool displays a local warning when it detects likely credentials. It does not redact values automatically because doing so would change the generated request.

Before sharing a snippet, replace real secrets with placeholders. For additional transport checks, inspect a public endpoint with ToolMint's HTTP Header Checker, but never submit a private or signed URL to a server-side checker.

JSON and form data

When the content type is JSON and the body parses without unsafe numeric changes, Fetch receives JSON.stringify(...) and Python receives json=.... A body containing an unquoted integer outside JavaScript's safe integer range stays a raw string so conversion does not silently change it. The JSON Formatter can help inspect ordinary JSON, and the guide to pretty-printing JSON explains common validity problems.

Form URL-encoded data preserves repeated keys without decoding and re-encoding already escaped values unnecessarily. With -G, applicable data is appended to the existing query string instead of becoming a request body. Review the URL encoding and Base64 guide or use the URL Encoder / Decoder when you need to inspect percent-encoded values. The Base64 Encoder / Decoder handles a different representation and is not a substitute for URL encoding.

Multipart conversion supports scalar text fields. File-backed fields such as -F "file=@photo.jpg" are rejected because a pasted filesystem path cannot be carried into portable browser code.

Privacy and credentials

Parsing and generation happen synchronously in the current browser tab. ToolMint does not execute the command, fetch its URL, resolve its hostname, send the input to an API, save it to localStorage or include private request data in analytics. Input disappears when you clear it, refresh the page or close the tab.

Generated output, including Request JSON, can still contain the credentials that were present in the pasted command. Treat that output like the original command: review it before downloading, committing or sending it to another person.

cURL vs Fetch differences

cURL does not follow redirects by default, while Fetch normally does. When -L is absent, the generator uses redirect: "manual" and warns that browser manual-redirect responses can be opaque. When -L is present, the normal Fetch redirect behavior is used.

Browser Fetch does not expose a cURL-style switch for bypassing TLS certificate validation. It can also restrict or override headers such as Cookie, User-Agent and Referer. The converter reports these differences rather than generating fake compatibility code. The HTTP security headers guide provides context for browser and server header controls.

cURL vs Python Requests differences

Python Requests runs outside the browser and can represent more command-line behavior, including verify=False for the cURL --insecure option. That setting weakens certificate verification, so generated code includes a visible warning and should not be copied into production without a deliberate security review.

Redirect defaults also depend on the Requests method. The generator sets allow_redirects when needed to reflect the cURL choice, but proxies, certificates, low-level connection routing and HTTP-version forcing remain outside this converter's scope.

Explore more browser-side utilities in the Developer tools category.

Sources

Frequently asked questions

Paste one cURL command, choose Request JSON and select Convert. Copy the result or download curl-request.json. It describes the request without running it or retrieving a server response.

Headers, decoded query parameters and multipart fields use ordered lists, so repeated names remain separate. Body text stays in body.raw as a string, preserving large integer IDs, decimal spelling and duplicate JSON member names after shell quoting is parsed.

Paste one cURL command, choose JavaScript Fetch and select Convert. ToolMint maps supported methods, headers, query data, JSON and form fields into modern Fetch code and shows warnings where browser behavior differs from cURL.

Paste the command, choose Python Requests and select Convert. The output uses requests convenience methods where possible and requests.request for a valid custom HTTP method.

No. The converter treats your command as inert text. It does not run cURL, fetch the URL, perform DNS lookup or proxy a request.

No. Commands and generated output stay in browser memory and are not sent to ToolMint servers or analytics. A local warning appears when the command seems to contain credentials.

The converter supports common request methods, URLs, repeated headers, literal data, scalar form fields, basic auth, cookies, redirects, HEAD, GET query data, insecure-mode detection, compression hints, User-Agent and Referer.

Yes. Ordinary form-encoded data and scalar multipart fields can be converted. Local file-backed fields such as file=@photo.jpg are rejected because a pasted path cannot be made portable or safely read by the browser.

Browser Fetch follows browser security rules. It cannot disable TLS certificate checks, freely set every restricted header or always expose manual redirect details in the same way as command-line cURL.

Yes. Authorization headers are preserved, and -u or --user is mapped to Python Requests auth or a Basic Authorization header for Fetch. Review generated code carefully because it may contain credentials.
9 min read Works in browser Privacy notes