HTML global attributeGlobal attributes

spellcheck

Turns spell checking on or off in editable text.

Applies to
Editable elements: text fields and elements with contenteditable
On this page

Example

#
HTML
<textarea spellcheck="true" rows="2">This sentense has a spelling mistake</textarea>
<textarea spellcheck="false" rows="2">const usrNme = "jake_dev"</textarea>
Preview

Definition and usage

#

The spellcheck attribute tells the browser whether to underline spelling mistakes in text fields and in elements with contenteditable.

Turning it off is useful in fields where the dictionary only gets in the way: usernames, codes, addresses, code snippets. In ordinary fields for longer text it is worth leaving it on.

It is only a hint. The final decision is made by the browser and the system settings, and the check uses the dictionary of the language set by the lang attribute.

Syntax

#
Syntax
<element spellcheck="true | false">…</element>

Values

#
  • true

    Check spelling.
  • false

    Do not check spelling.

Browser support

#

Widely available

Works in all modern browsers, phones included. You can use it without worry.

  • Chrome
  • Edge
  • Firefox
  • Safari

Good practices

#
  • In fields for code and identifiers, combine spellcheck="false" with autocomplete="off" and autocapitalize="off".
  • Set a correct lang, otherwise the browser may underline correct words.

Related entries

#

Spotted a mistake or missing an example? Write to us.