What HTML attribute makes a form element mandatory before submission?

The story behind the answer

The required attribute makes a form control mandatory before submission.

When a supported control has required, the browser’s built-in constraint-validation system prevents submission if the user has left the control empty. For example, <input name="email" required> tells the browser that a value must be supplied. The browser may display a validation message and focus the incomplete control, although the exact wording and appearance vary by browser and language.

The attribute is a Boolean attribute, so its presence is what matters. In HTML, required="true" is not the usual conceptual model: simply writing required is sufficient, and writing required="false" still leaves the attribute present. It can be used with several input types, as well as elements such as <select> and <textarea>, subject to their validation rules.

A frequent misconception is that required provides complete security or server-side validation. Users can bypass client-side checks, so a server must validate submitted data independently. The attribute also does not determine whether a value has the correct format; type, pattern, min, max, and other constraints handle those checks.

Source: Wikipedia · fact-checked Aug. 2026

Add question to a list

Choose a list to keep this question in: