November 22, 2026 What Is an HTML Checkbox and How Is It Used? When you want to gather data that can have multiple options at a time, so for it you can create checkboxes. User can select multiple option at the same time. Example <form method="post" name="frmCheckbox"> Which sport you like? <input type="checkbox" name="cricket" value="Cricket">Cricket <input type="checkbox" name="football" value="Football"> Football <input type="checkbox" name="tennis" value=" Tennis "> Tennis <input type="checkbox" name="hockey" value=" Hockey "> Hockey <input type="submit" name="save" value="Save"> </form> Output Which sport you like? Cricket Football Tennis Hockey FAQ 1. How Can I Make an HTML Checkbox Mandatory? You can add the required attribute to a checkbox to make it mandatory. This is useful when users must accept terms and conditions before submitting a form. 2. What Is the Purpose of the Value Attribute in an HTML Checkbox? The value attribute specifies the value submitted when the checkbox is selected. If the checkbox is not selected, its value is normally not included in the submitted form data. 3. How Can I Change the Size and Color of an HTML Checkbox? You can customize a checkbox using CSS. Properties such as width, height, accent-color, and cursor can help adjust its appearance and make it match your website design.