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, so you must write the value explicitly — spellcheck="true" or spellcheck="false".

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 | false (enumerated — the value is required)

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 if the elements value should have its spelling and grammar checked.
Are these attributes guaranteed to work?
No. They are hints that browsers and on-screen keyboards may honor or ignore, especially on desktop.
Which elements do they apply to?
They are global attributes, but they mainly affect editable and form fields.
Is spellcheck a global attribute?
Yes — it is a global attribute, so it can be set on any HTML element (it is a global attribute), most usefully on editable and form fields.