HTML Checkbox — Reference and Common Patterns
An HTML checkbox is `<input type="checkbox">`. Use for single yes/no questions (terms of service) and for multi-select groups (interests, preferences). Multiple checkboxes with the same `name` form an array on submission.
An HTML checkbox is `<input type="checkbox">`. The `value` attribute is what gets submitted when the checkbox is checked; if unchecked, the field is omitted from the submission entirely (not submitted as 'false' or empty string). This trips people up — make sure your backend handles the field-not-present case as 'unchecked'.
Multiple checkboxes with the same `name` form a group. The backend receives an array of all checked values. Example: three checkboxes named `topics` with values 'design', 'dev', 'seo' — if the user checks design and seo, the backend receives `topics=design&topics=seo`. splitforms reassembles this into an array for the dashboard.
Use `checked` to default-check a checkbox. Useful for newsletter opt-ins (the user can uncheck to opt out) or pre-filled preferences. Use `required` on a single checkbox (terms-of-service style) to block submission until checked. Required doesn't apply meaningfully to multi-select checkbox groups — there's no way to require at least one of N — for that, use a select or radio group.
Accessibility: wrap the checkbox in a `<label>` so the label text is clickable. For multi-select groups, wrap in a `<fieldset>` with `<legend>` describing the group. Screen readers announce the legend when any checkbox in the group is focused.
How to set this up
Use <input type="checkbox"> for yes/no choices
Single checkbox for terms agreement; multi-checkbox group for multi-select preferences.
Same name attribute = group
Multiple checkboxes with the same name submit as an array of checked values.
checked for default-on, required for blocking submit
checked pre-checks a checkbox; required (on a single checkbox) blocks submission until checked.
Wrap in <fieldset>+<legend> for multi-select
Semantic grouping for accessibility — screen readers announce the legend when any checkbox in the group is focused.
Same name = group. Unchecked = omitted from submission. Required blocks submit.
Frequently asked questions
How do I add multiple checkboxes in HTML?
Multiple <input type="checkbox"> elements with the same `name` attribute form a group. Each has a different `value`. The backend receives an array of all checked values.
Why doesn't an unchecked checkbox submit anything?
By HTML spec, unchecked checkboxes are simply omitted from form submission — not submitted as 'false' or empty. Your backend should treat 'field not present' as 'unchecked'.
How do I default-check a checkbox in HTML?
Add the `checked` attribute: <input type="checkbox" checked>. Common for newsletter opt-ins (user can uncheck) or pre-filled preferences.
How do I require a checkbox in HTML?
Add `required` to a single checkbox. Useful for terms-of-service agreement. Note: `required` on multi-select checkbox groups doesn't enforce 'at least one' — use a select or radio group for that pattern.
Checkbox vs radio button — which should I use?
Radio for single-choice (pick one of N — gender, payment method). Checkbox for multi-choice (pick zero or more — interests, preferences). The visual is similar; the semantics are different. Don't substitute one for the other.
Related guides
Ship the form, not the backend.
Free for 1,000 submissions/month. Email delivery, AI spam filtering, signed webhooks, real dashboard — all on the free plan. No credit card.
Get a free access key →