splitforms.com

HTML · ATTRIBUTE

HTML checked Attribute: Default Checkbox and Radio

Last reviewed

The checked boolean attribute sets the initial state of a checkbox or radio: its presence means on, even with checked="false". Only currently checked, enabled controls with a name submit name=value. A checkbox without a value attribute submits "on".

  • Live, editable example
  • Copy-paste snippet
  • Attributes & common mistakes
Live demo · nothing is sent

What gets submitted

Fill in the form above and press its button. The demo stops the request and lists every name=value pair the browser would send, plus the controls it leaves out.

With a free access key in the form, these fields land in your splitforms dashboard; access_key and botcheck are read by splitforms, not stored as lead data.

Edit the HTML and re-run it
Runs in a sandbox. Nothing is sent.

Minimal snippet

checked-example.html
<label><input type="checkbox" name="newsletter" value="yes" checked> Newsletter</label>
<fieldset>
  <legend>Contact method</legend>
  <label><input type="radio" name="contact" value="email" checked> Email</label>
  <label><input type="radio" name="contact" value="phone"> Phone</label>
</fieldset>

Copy-paste code

HTML checked attribute code you can paste today.

Replace YOUR_ACCESS_KEY with a key from your free splitforms dashboard. The form posts to one endpoint — submissions land in your inbox and dashboard with spam filtering built in.

Get free access key
checked.html
<form action="https://splitforms.com/api/submit" method="POST">
  <input type="hidden" name="access_key" value="YOUR_ACCESS_KEY">
  <label for="email">Email</label>
  <input type="email" id="email" name="email" required>
  <label><input type="checkbox" name="newsletter" value="yes" checked> Subscribe to the newsletter</label>
  <fieldset>
    <legend>Preferred contact method</legend>
    <label><input type="radio" name="contact" value="email" checked> Email</label>
    <label><input type="radio" name="contact" value="phone"> Phone</label>
  </fieldset>
  <input type="checkbox" name="botcheck" style="display:none">
  <button type="submit">Send preferences</button>
</form>

Attributes · checked

Which attributes affect checked inputs?

The checked state, name and value determine the form data.

HTML checked attribute attributes and what each one does
AttributeWhat it doesDocs
checkedSets the default checked state on a checkbox or radio.MDN
valueThe value submitted when the control is checked; without it, the value is on.MDN
nameThe submitted key; radios with the same name form a group.MDN
disabledExcludes the control from submission, even when checked.MDN

Common mistakes

Checked attribute mistakes to avoid

Distinguish the default state from the current state and submitted data.

  1. checked="false" is still checked

    Boolean attributes are true when present. Remove checked to make the default unchecked.

  2. The attribute is not the current state

    el.defaultChecked reflects the attribute; el.checked reads or sets the current state. After user interaction changes the state, setAttribute changes the default without necessarily changing the visible state. Form reset restores the default.

  3. Unchecked controls are omitted

    An unchecked checkbox or radio sends no pair. A checked control also needs a name and must not be disabled to submit.

Sources: WHATWG HTML Standard: checked · MDN: checked property

Copy-paste ready

The HTML checked attribute example below is a complete, working form — paste it into any HTML page and it submits, no edits to the markup required.

No backend to build

Your html checked attribute form posts to one endpoint. No server, PHP, or API route — accepted submissions are saved to your dashboard before owner notification email is attempted; delivery time and inbox placement depend on provider and recipient settings.

A form that really submits

Unlike a static reference snippet, this checked form actually sends data to a free splitforms backend, with spam filtering built in.

How it works

How to add HTML checked attribute to any page.

Copy the html checked attribute example, drop in your free access key, and paste it into any page — submissions start landing in your dashboard.

Copy the code

Copy the HTML checked attribute example below.

Add your access key

Replace YOUR_ACCESS_KEY with a free splitforms key from the dashboard.

Paste into your site

Drop the form into any HTML page. Submissions arrive in your dashboard.

How SplitForms works

What happens after someone submits your form?

splitforms receives the submission, filters spam, saves it to your dashboard and emails you — then, on paid plans, sends it on to your webhooks and integrations. No backend infrastructure to build.

A SplitForms contact form submission launching straight to your inbox

Add your endpoint

Point your form to your unique SplitForms endpoint. That's it.

HTML form pointing at a SplitForms submit endpoint

Receive submissions

We instantly capture and organize every submission in your inbox.

Submissions inbox with searchable leads and status pills

Route anywhere

Send data to email, spreadsheets, CRMs, webhooks, and 7,000+ apps.

Generic integration tiles for email, sheets, chat, CRM, automate, and webhook

No credit card required. Set up in under 60 seconds.

Connect & automate

Where can submissions go besides email?

On paid plans, submissions can also go to Slack, Discord, Google Sheets, Notion, Airtable, Zapier or any signed webhook — and splitforms works on the platforms you build on, from WordPress and Shopify to Next.js. With Stripe connected, your forms can take payments too.

Connect your SplitForms form to Slack, Google Sheets, Mailchimp, Zapier and more
NewTake payments on your formsDeposits, bookings, order forms — submitters check out through Stripe and the money goes straight to your Stripe account. Included on every paid plan.See payment forms →Need time slots? Online booking →

Setup guides for the stacks you use

Questions

HTML checked attribute questions, answered.

View all FAQs
How do I check a checkbox or radio by default?

Add the `checked` attribute to the checkbox or to one radio in a same-named group. Remove the attribute for an unchecked default; `checked="false"` still counts as present.

What is the difference between checked, :checked and .checked?

The HTML `checked` attribute sets the default. CSS `:checked` matches the current checked state. The JavaScript property `el.checked` reads or changes that current state, while `el.defaultChecked` reflects the attribute.

Why does setAttribute not update a checkbox after interaction?

Once interaction changes checkedness, the control's checkedness is dirty. Changing the attribute updates the default but does not overwrite the current state; set `el.checked` to change it directly.

How can I send a value when a checkbox is unchecked?

Place `<input type="hidden" name="newsletter" value="no">` before a checkbox with the same name and value="yes". When checked, both pairs are submitted, so configure the server to handle duplicate names and select the intended value.

What gets submitted for checked inputs?

Each enabled, named checked checkbox sends its name and value, or "on" if value is missing. A radio group sends the selected enabled radio's pair; an unchecked control sends nothing.

Simple pricing

How much does splitforms cost?

Free gives you 500 submissions for $0 — no card, no time limit. Pro is $5/month for 5,000 submissions a month, and Annual is $49/year for 15,000 a month with every Pro feature.

Free

$0— 500 submissions
 

No card, no time limit

Best for testing

For side projects and indie devs.

  • 500 free submissions
  • Unlimited forms
  • Email notifications included
  • Smart spam filtering
  • Submissions dashboard
  • Redirect after submit
  • MCP server included

Annual

$49/ year
About $4.08 per month, billed yearly
Best value

Every Pro feature with triple the volume — $0.27 per 1,000 at full use.

  • 15,000 submissions per month
  • Unlimited forms
  • Everything in Pro
  • File uploads with 5 GB storage
  • 3 team seats
  • Priority email support

No credit card required on Free • Cancel anytime • Full pricing and FAQ