References

Beginner-friendly references for web development, with live, editable examples.

The HTML spellcheck attribute

Global attribute Works on every element All modern browsers Updated
Quick answer

The HTML spellcheck attribute hints whether the browser should check the spelling and grammar of an element's editable content. Use spellcheck="true" or "false". It is a global attribute that applies to form fields and contenteditable regions.

Overview

The spellcheck attribute asks the browser to spell- and grammar-check editable text such as <input>, <textarea> and contenteditable elements. It is an enumerated attribute, not a boolean: a bare spellcheck or spellcheck="true" turns checking on, and only spellcheck="false" turns it off.

The result depends on the browser and operating system, and the attribute is only a hint. Turn it off for fields where checking is unhelpful or distracting, such as usernames, email addresses, codes and serial numbers.

Syntax

<textarea spellcheck="true"></textarea>
<input type="text" spellcheck="false">

Values

Value
true (or empty) | false

Example

Live example
<textarea spellcheck="true" rows="2" style="width:100%; padding:8px;">Tpe a missspelled wrd to see the check.</textarea>

Best practices

  • Use inputmode to bring up the right on-screen keyboard (numeric, email, and so on).
  • Set autocapitalize appropriately: off for names and codes, sentences for prose.
  • These are hints; do not rely on them for validation.
  • Test on real mobile devices, where most of these take effect.

Frequently asked questions

What does the spellcheck attribute do?
Specifies whether the element's value should have its spelling and grammar checked.
Is spellcheck guaranteed to work?
No. It is a hint. Whether spelling is actually checked depends on the browser and on the dictionaries installed on the operating system.
Which elements does spellcheck affect?
It is a global attribute, but it only has an effect where text can be edited: <input> and <textarea> fields and elements with contenteditable.
Is spellcheck a global attribute?
Yes, it is a global attribute, so it can be set on any HTML element, most usefully on editable and form fields.