Drag fields onto the canvas, edit labels, placeholders and validation rules, and watch a working preview update as you go. Copy clean, accessible HTML and CSS that works with any backend, or download a complete page.
Last updated:
Form fields
Field properties
Advertisement
Advertisement
How to use the HTML Form Builder
Start from a template or a blank form, and set the form title, action URL and method in Form settings.
Add fields: drag a field type onto the canvas or click it to add it below the selected field. Drag fields (or use the arrow buttons) to reorder them.
Edit the selected field: label, name, placeholder, help text, options and validation rules such as required, length or pattern.
Test the preview: fill it in and press submit to see browser validation and the data that would be sent.
Copy the code: copy the HTML and CSS separately or download a complete page, then point the action URL at your form handler.
HTML form validation attributes
The generated code relies on the browser's built-in constraint validation, so it works without JavaScript. These are the attributes the builder can add:
Attribute
Works on
Example
Effect
required
All fields
required
Field must be filled (a radio group needs one choice, a checkbox must be ticked)
type
input
type="email"
email and url must be well formed; number only accepts numbers
minlength / maxlength
Text, email, password, textarea
minlength="8"
Limits the number of characters
min / max / step
number, date, time
min="0" max="10"
Allowed range and increments
pattern
Text, tel, password
pattern="[0-9]{5}"
The whole value must match the regular expression
title
With pattern
title="5 digits"
Hint shown in the browser's error message
accept
file
accept=".pdf,image/*"
Filters the file picker (not a security check)
autocomplete
Text-like inputs
autocomplete="email"
Lets browsers and password managers fill the field (WCAG 1.3.5)
Useful pattern examples
Use
Pattern
US ZIP code (5 or 9 digits)
\d{5}(-\d{4})?
UK postcode (simplified)
[A-Za-z]{1,2}\d[A-Za-z\d]? ?\d[A-Za-z]{2}
Phone number (digits, spaces, + ( ) -)
[0-9 +()\-]{7,20}
Username (3-16 letters, digits, _)
[A-Za-z0-9_]{3,16}
Strong password (8+, upper, lower, digit)
(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{8,}
Hex color
#?[0-9A-Fa-f]{6}
The browser anchors patterns automatically, so ^ and $ are not needed.
Accessible form checklist
Visible labels for every field, connected with for and id. Placeholders disappear when typing and are not a substitute.
Group related choices (radio buttons, checkbox groups) in a <fieldset> with a <legend> that asks the question.
Explain the format in help text linked with aria-describedby, for example "At least 8 characters".
Mark required fields visibly and with the required attribute, and say what the asterisk means.
Keep good contrast for text, borders and the submit button (at least 4.5:1 for text).
Validate on the server too. Browser validation helps users but anyone can bypass it.
Frequently asked questions
Does the form send emails or store submissions?
No. This tool generates front-end HTML and CSS only. Set the form's action URL to your own server script or a form backend service, which receives the fields by their name attributes and handles email or storage.
What makes the generated form accessible?
Every input has a visible label connected with for and id, radio and checkbox groups are wrapped in a fieldset with a legend, help text is linked with aria-describedby, required fields use the native required attribute, and common fields get autocomplete hints so browsers and assistive technology can fill them in.
How does validation work?
The form uses built-in HTML validation: required, type=email/url/number, min and max, minlength and maxlength, and pattern (a regular expression the whole value must match). Browsers block submission and show a message until the rules are met. Always validate again on the server.
Why is the name attribute important?
Only fields with a name are submitted, and the name becomes the key in the submitted data (for example [email protected]). Use unique, lowercase names without spaces.
When is enctype=multipart/form-data needed?
Whenever the form has a file upload field and uses POST. The builder adds it automatically when you add a file field.
GET or POST?
Use POST for forms that send personal data, messages or files, or that change something on the server. GET puts the data in the URL and suits search and filter forms.
Is my form saved?
Your current form is saved in this browser's local storage so you can come back to it. Nothing is uploaded.
Are all the tools on FreeToolCabin tested for quality and accuracy?
Yes! Every tool on our site undergoes automated Q/A testing in real browser environments to ensure high precision, correct output, and zero errors. If you happen to spot a bug or have a suggestion, please contact us at [email protected] and our team will review it right away.