HTML Form to cURL Command Converter
Paste a <form>'s HTML and get a ready-to-run curl command — parses action/method/enctype and every named input, handling multipart/form-data vs urlencoded, checkboxes, selects, Basic Auth and custom headers.
Input
Paste a whole page or just the <form>…</form> markup.
A 1-based form number, or "all" to convert every form on the page.
Resolves a relative action ("/login") into a full URL. Ignored if action is already absolute.
One name=value per line — replaces the value/checked state found in the HTML for that field.
One header per line, formatted as "Key: Value".
Output
| Name | Type | Value | Included |
|---|---|---|---|
| No data yet | |||
More ways to use this tool
REST API
curl -X POST https://api.iotools.cloud/v1/tool/html-form-to-curl-converter \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"html": "<form action=\"/login\" method=\"post\">\n <input na…",
"form": "1",
"baseUrl": "https://example.com",
"overrides": "",
"headers": "",
"basicAuthUser": "",
"basicAuthPass": "",
"followRedirects": "true"
}'Swap in your own key from your account. The tool's fields are the body — no wrapper.
Ask an AI agent
Use the IOTools `html-form-to-curl-converter` tool (HTML Form to cURL Command Converter) on this input:
YOUR_INPUT_HEREPaste this at any agent connected to the IOTools MCP server, then add your input.
Embed widget
<iframe
src="https://iotools.cloud/embed/html-form-to-curl-converter/"
width="100%" height="520" frameborder="0" scrolling="no" loading="lazy"
title="HTML Form to cURL Command Converter — iotools.cloud"
sandbox="allow-scripts allow-forms allow-same-origin allow-downloads allow-popups allow-popups-to-escape-sandbox"
allow="clipboard-write"
style="width:100%;border:1px solid #e5e7eb;border-radius:12px;overflow:hidden"></iframe>
<script src="https://iotools.cloud/embed.js" async></script>Drop this into your own page — free, no key required, just a link back.
| Cost per API/MCP call | From 5 credits |
|---|---|
| Need more credits? | View pricing |
Also available with
Guides
Found a login or search form in a page's source and need to hit the same endpoint from a terminal, a script, or a bug report? Paste the <form> markup here and get back a curl command that submits it the way a browser would — same URL, same method, same field names, same encoding. Everything runs in your browser; the HTML never leaves your machine.
How to use it
- Paste the form's HTML into the input box, or drop an
.htmlfile onto the uploader. A whole saved page works fine — anything outside<form>…</form>is ignored. - If the action attribute is relative (
/loginrather thanhttps://example.com/login), fill in Base URL so the generated command has a real address to hit. - Check the Parsed fields table to see exactly what was found — every named input, its type, the value that will be sent, and whether it's actually included.
- Need different sample data than what's in the HTML? Add
name=valuelines to Override field values instead of editing the markup. - Add any Extra headers, Basic Auth credentials, or toggle Follow redirects, then copy or download the command.
How fields are chosen
This follows the same rules a browser applies when you click submit:
- Checkboxes and radio buttons are only included if they carry a
checkedattribute — an unchecked box is never sent, matching real form behavior. <select>sends the option markedselected, or the first option if none is marked — never a blank value.- Disabled fields are always excluded.
<button type="reset">/type="button">are UI-only and never submitted, so they're dropped.<input type="file">can't carry real file bytes from pasted markup, so it becomes a-F 'name=@/path/to/file'placeholder — edit the path before running.
Settings
- Form to convert — a 1-based number (
1,2,3…), orallto emit onecurlcommand per form on the page. - Base URL — resolves a relative
actioninto an absolute URL. Ignored once the action is already absolute. - Override field values —
name=valueper line, applied after parsing. Useful for swapping in a real password or a fresh CSRF token without touching the HTML.
Why does GET produce a URL with a query string instead of -d?
Because that's what actually happens: a method="get" form never sends a body — the browser appends every field to the URL as a query string before navigating. Reproducing that with -d would hit a different code path on the server than a real form submission does.
What's the difference between the urlencoded and multipart output?
A plain form (or one with no enctype) submits application/x-www-form-urlencoded data, so each field becomes a --data-urlencode 'name=value' flag. Adding enctype="multipart/form-data" — required for file uploads — switches every field to -F 'name=value' instead, which curl sends as a multipart body.
Can it fetch a form from a URL?
No, and that's deliberate: nothing is uploaded or fetched, so the tool works on internal pages, logged-in dashboards and localhost just as well as on public sites. Use your browser's "View source" or DevTools → Copy element, then paste.
Related tools
Building a curl command from scratch instead of pasting existing markup? cURL Command Builder covers manual URL/header/body entry with the same flags. To pull tabular data out of pasted HTML instead of a form, see HTML Table Extractor.