HTML form generator — build a labelled form from a simple field list

Write one line per field in the form "Label | type | required | options" and get a complete form with a linked label for every control, radio groups in a fieldset with a legend, autocomplete on email, phone and name fields, and a submit button.

Live demo · real result from this tool
Method

Press Generate to create a result.

Processed on your device — nothing is uploaded.

How to use the HTML form generator

  1. In Fields: Label | type | required | options, write one field per line. Separate the parts with |.
  2. Use a type such as text, email, tel, number, date, textarea, select, checkbox or radio. For select and radio, list the options in the fourth part, separated by commas.
  3. Choose the Method (POST or GET) and enter the Action URL.
  4. Set the Button text.
  5. Copy the form and try it in the Preview.

What it does and when to use it

Most forms are a handful of familiar fields, yet hand-written forms often skip the details that make them usable: labels not tied to inputs, radio buttons without a group name, no autocomplete, and a submit button with no type. This generator handles those details for every field, so you can describe a contact, booking or feedback form in a few lines.

Each control type gets the markup it needs. Text-like inputs and textareas get a label for that matches their id. A select gets an empty first option, “Choose…”, so nobody submits the first real choice by accident. A checkbox is wrapped in its label with value="yes". Fields of type email and tel, and text fields whose label contains “name”, get the matching autocomplete token.

To fine-tune one field, such as adding help text or a pattern, use the HTML Input Generator. For a long dropdown with groups, the HTML Select Dropdown Generator supports optgroup and preselected values. To restyle the submit button, see the HTML Button Generator.

How it works

Each line is split at | and trimmed. Missing parts take defaults: type text, not required, no options. Labels and option texts are HTML-escaped; option values are slugs of the option text, so “Sales” becomes sales. The form is indented two spaces per level and ends with <button type="submit">. It is built in your browser.

Worked examples

The default contact form has six fields. The Topic line, Topic | select | required | Sales, Support, Billing, becomes:

<label for="topic">Topic</label>
<select id="topic" name="topic" required>
  <option value="">Choose…</option>
  <option value="sales">Sales</option>

A search form with GET, using the lines Size | radio | | S, M, L, Name | text and Name | text again:

<fieldset>
  <legend>Size</legend>
  <label><input type="radio" name="size" value="s"> S</label>

The duplicate label gives <input type="text" id="name-2" name="name-2" autocomplete="name">, so both fields keep unique ids.

Limits and tips

  • Check data on the server too. Browser checks such as required are easy to bypass.
  • The tool writes no CSS. The preview uses simple styles only to show the layout.
  • To check the finished page for broken label for links, run it through the HTML Validator.

Frequently asked questions

Does the form send emails or store data?
No. The generator writes the HTML only. The form sends its data to the Action URL you enter, and something there, such as your own server script or a form-handling service, has to receive and process it.
Should I use POST or GET?
POST for forms that send messages, sign people up or change data; the values travel in the request body. GET for searches and filters; the values appear in the URL, so results can be bookmarked and shared. Never use GET for passwords or personal details.
What words mark a field as required?
Put required, yes, y, true or an asterisk in the third column. Anything else, or leaving it empty, makes the field optional. Required fields get the HTML required attribute, so the browser checks them before sending.
Why are radio buttons in a fieldset?
A group of radio buttons shares one question. The fieldset and legend give the group that question as its name, so a screen reader says "Size, S, radio button" instead of just "S". Each radio button is wrapped in its own label so the letter is clickable too.
How are the name and id chosen?
From the label, in lower case with accents removed and spaces turned into hyphens; "Full name" becomes full-name. If fields share a label, the second gets -2, the third -3 and so on, so ids stay unique.

Written by the ToolsRift team · Last updated

Pages are drafted with AI assistance and checked by automated tests. How we write and check pages.

Was this tool useful?

Report a problem

Start typing to search every tool.

↑ ↓ to moveEnter to openEsc to close