splitforms.com
guide · html elements

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.

html
<form action="https://splitforms.com/api/submit" method="POST">
  <input type="hidden" name="access_key" value="YOUR_ACCESS_KEY" />
  <input name="email" type="email" required />

  <!-- Single checkbox (terms agreement) -->
  <label>
    <input type="checkbox" name="agree" value="yes" required />
    I agree to the <a href="/terms">terms</a>
  </label>

  <!-- Multi-select checkbox group (same name attribute) -->
  <fieldset>
    <legend>Topics you're interested in</legend>
    <label><input type="checkbox" name="topics" value="design" /> Design</label>
    <label><input type="checkbox" name="topics" value="dev" /> Development</label>
    <label><input type="checkbox" name="topics" value="seo" /> SEO</label>
    <label><input type="checkbox" name="topics" value="content" /> Content</label>
  </fieldset>

  <!-- Single checkbox with default-checked -->
  <label>
    <input type="checkbox" name="newsletter" value="yes" checked />
    Send me the weekly newsletter
  </label>

  <button type="submit">Submit</button>
</form>

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

Step 01

Use <input type="checkbox"> for yes/no choices

Single checkbox for terms agreement; multi-checkbox group for multi-select preferences.

Step 02

Same name attribute = group

Multiple checkboxes with the same name submit as an array of checked values.

Step 03

checked for default-on, required for blocking submit

checked pre-checks a checkbox; required (on a single checkbox) blocks submission until checked.

Step 04

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

HTML forms

HTML Form — How to Build and Submit Forms in HTML

HTML elements

HTML Radio Button — Working Code and Common Patterns

HTML elements

HTML Input Types — Complete Reference (2026)

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 →