The HTML input element <input type="checkbox"> allows you to select a single value for submission in a form (or not).

Note: If a checkbox is unchecked and then the form is submitted, there is no value=unchecked data submitted; the value is not submitted to the server at all.

Attributes

This element includes the global attributes.

checked

When the value of the type attribute is checkbox, the presence of this attribute indicates that the control is selected by default. You can specify this as checked="checked", or simply just checked.

value
Specifies the value for the control. If omitted, the result of getting the value property of the element will be the string "on".
Note that if the value is changed and then the page is reloaded, Gecko and IE will ignore the value specified in the HTML source.
indeterminate
Indicates that the checkbox is in an indeterminate state (on most platforms, this draws a horizontal line across the checkbox).

Example

<p>
  <input type="checkbox" id="cbox1" value="first_checkbox">
  <label for="cbox1">This is the first checkbox</label>
</p>
<p>
  <input type="checkbox" id="cbox2" value="second_checkbox" checked="checked">
  <label for="cbox2">This is the second checkbox, which is checked</label>
</p>

This creates two checkboxes, which look like this:

Specifications

Specification Status
WHATWG HTML Living Standard
The definition of '<checkbox>' in that specification.
Living Standard  
HTML5
The definition of '<checkbox>' in that specification.
Recommendation  
HTML 4.01 Specification
The definition of '<checkbox>' in that specification.
Recommendation  

Browser compatibility

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari
Basic support 1.0 1.0 (1.7 or earlier) 2 or earlier 1.0 1.0
type=checkbox 1.0 1.0 (1.7 or earlier)
3.6 (1.9.2) for indeterminate value
2 1.0 1.0
Feature Android Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
Basic support (Yes) 4.0 (2.0) (Yes) (Yes) (Yes)
type=checkbox (Yes) (Yes) (Yes) (Yes) (Yes)

Document Tags and Contributors

 Last updated by: chrisdavidmills,