HTML checked Attribute

Beginner
5 min read
Updated: Oct 2026
3 examples
Live preview

Definition and Usage

The checked attribute is a boolean on <input type="checkbox"> and type="radio". When present, the control is selected by default when the page loads.

Always pair controls with a <label>. Use the same name for a radio group (one choice). Set a clear value for what gets submitted. For <option>, use selected instead.

Baseline · Widely available.

Not deprecated. Standard on checkbox and radio inputs across modern browsers.

Default state, not a live mirror.

After the user clicks, the HTML checked attribute does not rewrite itself. Read the current state with the JavaScript property element.checked; the attribute maps to defaultChecked.

HTML Syntax

syntax.html
<input type="checkbox|radio"  checked>

Boolean form: write the name alone. checked="" or checked="checked" means the same thing.

Attribute Values

checked is boolean — presence turns the default selection on:

ValueDescriptionTry it
checked (present)Control is selected when the page first loadsTry it
(absent)Control starts unchecked / unselectedTry it
On radioMarks the default option in a same-name groupTry it
Multiple checkboxesSeveral boxes can be checked at onceTry it

Live Preview

Toggle the HTML checked attribute (default), then click the box and compare defaultChecked vs live .checked.

Apply resets the control from the attribute. Clicking updates only the live property.

Checkbox

HTML Examples

Short, copy-ready snippets. Use Try It Yourself for a live editor.

Example 1 — Checkbox Checked by Default

Preselect a newsletter opt-in when the form opens.

HTML
<label for="news">
  <input type="checkbox" id="news" name="subscribe" value="yes" checked>
  Subscribe to the newsletter
</label>
Try It Yourself

How It Works

  1. type="checkbox" creates an on/off control.
  2. checked selects it on first load.
  3. label enlarges the click target and names the control.
  4. value is what gets submitted if the box stays checked (here yes).

Example 2 — Default Radio in a Group

Same name groups radios; only one can be selected — mark the default with checked.

HTML
<fieldset>
  <legend>Preferred contact</legend>
  <label>
    <input type="radio" name="contact" value="email" checked>
    Email
  </label>
  <label>
    <input type="radio" name="contact" value="phone">
    Phone
  </label>
</fieldset>
Try It Yourself

How It Works

  1. Shared name makes a single-choice group.
  2. One checked option is the default selection.
  3. fieldset / legend group the question for accessibility.
  4. Only the chosen radio is submitted with the form.

Example 3 — Several Checkboxes (Some Prechecked)

Related options can share a name; multiple boxes may start checked.

HTML
<fieldset>
  <legend>Choose your interests</legend>
  <label>
    <input type="checkbox" name="interest" value="coding" checked>
    Coding
  </label>
  <label>
    <input type="checkbox" name="interest" value="music" checked>
    Music
  </label>
  <label>
    <input type="checkbox" name="interest" value="art">
    Art
  </label>
</fieldset>
Try It Yourself

How It Works

  1. Each checkbox is independent — many can be checked.
  2. checked on Coding and Music sets those defaults.
  3. Same name submits multiple interest=… pairs when more than one is on.
  4. Unchecked Art is omitted from the submission until the user selects it.

Edge Cases & Pitfalls

Most confusion is attribute vs property, or expecting unchecked boxes in the POST body.

IDL

Attribute ≠ live property

defaultChecked mirrors the HTML attribute. element.checked is the current UI state after clicks.

submit

Unchecked means omitted

Unchecked boxes send nothing. Default submitted value is on if you omit value.

radio

One default per group

Mark at most one radio checked in a same-name group. Multiple defaults are invalid markup.

Firefox

Firefox may remember clicks

Firefox can persist dynamic checked state across reloads. Use autocomplete="off" on the control when you need a fresh default every time.

option

Not for <option>

Use selected on options. checked is for checkbox/radio inputs.

Browser Support

checked is an HTML attribute on checkbox and radio inputs. It is not a Node.js, Deno, or Bun API.

✓ Baseline · Widely available

checked

Supported everywhere modern browsers run. Use labels for accessibility; remember Firefox may persist dynamic state unless autocomplete is controlled.

99% Global support (approx.)
Google Chrome All
Full support
Mozilla Firefox All (may persist state)
Full support
Apple Safari All
Full support
Microsoft Edge All
Full support
Opera All
Full support
Samsung Internet All modern
Full support
Internet Explorer All
Supported
checked Widely supported

Bottom line: Safe to use. Pair with labels, clear values, and autocomplete="off" when reload must restore the HTML default in Firefox.

Key Takeaways

  • Role: default-selected checkbox or radio on page load.
  • Boolean — presence means selected by default.
  • Attribute vs property: HTML → defaultChecked; live UI → .checked.
  • Submit: only currently checked controls are sent.

One line: checked sets the default selection — use .checked in JavaScript for the current state.

Frequently Asked Questions

On checkbox and radio inputs, checked means the control is selected by default when the page loads. It sets the default state (defaultChecked), not a live mirror of every later click.
Primarily input type="checkbox" and input type="radio". For select options, use the selected attribute instead.
Yes. Presence means true. Writing checked, checked="", or checked="checked" are equivalent.
No. The content attribute stays as written. The live state is the IDL property element.checked. defaultChecked reflects the HTML attribute.
No. Only currently checked checkboxes and radios are included. The submitted value comes from the value attribute (default "on").
No. It is Baseline widely available and standard for checkboxes and radios.

Next: cite

Point blockquote and q elements at a citation URL.

cite tutorial →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

8 people found this page helpful