👀 Live Preview
Two editable boxes—spellcheck enabled on the first, disabled on the second. Type a misspelled word to compare:
Underline behavior depends on your browser language settings.

The spellcheck attribute lets you control whether the browser should check spelling in editable text. When enabled, misspelled words are often marked with a red underline so users can fix them before submitting a form or publishing content.
spellcheck is a global attribute, but it only affects elements where the user can type or edit text—such as <textarea>, text-like <input> fields, and elements with contenteditable. It is a hint to the browser; users can still override spell checking in their browser or OS settings.
Boolean values.
Long-form text.
Rich text areas.
Code & usernames.
.spellcheck property.
Hints, not rules.
spellcheckThe primary purpose of the spellcheck attribute is to tell the browser whether to perform spell checking on text inside an editable element. Most browsers enable spell checking by default on fields like <textarea>, but you can turn it off when underlines would be unhelpful—for example on code editors, product SKUs, or usernames that are not dictionary words.
Spell checking improves writing quality in comments, bios, and message boxes. It is not a substitute for server-side validation or grammar tools; it is a lightweight, built-in UX feature that runs locally in the user’s browser.
Even with spellcheck="true", the browser may skip checking if the user disabled spell check globally, if the field type does not support it, or if the language dictionary is unavailable. Always design forms so they work without relying on red underlines.
Add spellcheck to any editable element with true or false:
<!-- Spell checking on (common for textarea) -->
<textarea spellcheck="true"></textarea>
<!-- Spell checking off (usernames, code) -->
<input type="text" spellcheck="false">
<!-- contenteditable region -->
<div contenteditable="true" spellcheck="true">Edit me</div>true or false (boolean attribute semantics).textarea).element.spellcheck, not a string.The spellcheck attribute accepts two enumerated values:
spellcheck="true" — Ask the browser to check spelling in this editable element.spellcheck="false" — Ask the browser not to check spelling (no red underlines from spell check).textarea and many contenteditable regions.<textarea spellcheck="true">Comment with spell help</textarea>
<input type="text" spellcheck="false" name="handle">
<div contenteditable="true" spellcheck="false">
Code snippet: const foo = bar;
</div>| Topic | Detail | Example |
|---|---|---|
| Type | Boolean enumerated | true / false |
| Scope | Global attribute | Editable elements only |
| Common on | textarea, input | spellcheck="true" |
| Turn off for | Usernames, code, tokens | spellcheck="false" |
| JavaScript | el.spellcheck = false | Boolean property |
| Not validation | Visual hint only | Validate on server too |
| Element | Effect? | Notes |
|---|---|---|
<textarea> | Yes | Most common use; often enabled by default |
<input type="text"> | Yes | search, email, url, tel also support editing |
contenteditable | Yes | Rich text editors, inline editing |
<input type="password"> | Usually off | Browsers typically disable spell check for security |
<input type="number"> | No | Not meaningful for numeric fields |
Static <p>, <div> | No | Unless contenteditable is set |
spellcheck vs validation vs autocorrect| Feature | spellcheck | required / pattern | Mobile autocorrect |
|---|---|---|---|
| Purpose | Mark spelling mistakes | Enforce form rules | OS keyboard suggestions |
| Blocks submit? | No | Yes when invalid | No |
| Controlled by | HTML attribute | HTML + browser validation | Device / browser settings |
| Turn off with | spellcheck="false" | Remove constraint attrs | autocorrect="off" (mobile) |
contenteditable with spellcheck on vs off, JavaScript toggle, and form fields (textarea / input).
Two editable boxes—spellcheck enabled on the first, disabled on the second. Type a misspelled word to compare:
Underline behavior depends on your browser language settings.
Enable or disable spell checking on editable <div> elements:
<div contenteditable="true" spellcheck="true">
<p>Editable content with spell-checking enabled.</p>
</div>
<div contenteditable="true" spellcheck="false">
<p>Editable content with spell-checking disabled.</p>
</div>Both div elements are editable via contenteditable="true". The spellcheck attribute tells the browser whether to run its dictionary check on typed text inside each region.
Toggle spell checking at runtime with the spellcheck IDL property:
<div id="dynamicElement" contenteditable="true" spellcheck="true">
Type here...
</div>
<button type="button" id="toggleBtn">Toggle spellcheck</button>
<script>
var el = document.getElementById("dynamicElement");
document.getElementById("toggleBtn").addEventListener("click", function () {
el.spellcheck = !el.spellcheck;
});
</script>The JavaScript property is a boolean. Assign false to stop new spell-check underlines; assign true to re-enable checking. Useful when switching between “plain text” and “code” modes in one editor.
Use spellcheck on prose fields and turn it off for identifiers:
<label for="bio">Bio:</label>
<textarea id="bio" spellcheck="true"></textarea>
<label for="username">Username:</label>
<input type="text" id="username" spellcheck="false">Long-form fields benefit from spell help; short identifier fields often disable it so valid handles are not flagged as dictionary errors.
<label> with textarea and input so users know what to type.lang on the page or field so the browser picks the correct dictionary.true or false on field.
In editable element.
Dictionary + language.
Underlines on typos.
The spellcheck attribute is supported in all modern browsers on editable elements. Exact underline styling and dictionary behavior may vary.
Chrome, Firefox, Safari, and Edge honor spellcheck on supported fields.
Bottom line: Use spellcheck confidently; test across browsers and languages for your audience.
lang so the correct dictionary is usedspellcheck="true" blocks invalid submissionsautocorrectThe spellcheck attribute is a practical way to control browser spell checking on editable HTML elements. Used well, it helps users catch typos in prose fields while staying out of the way in code and identifier inputs.
Pair it with clear labels, proper lang attributes, and server-side validation for a complete input experience. Toggle it dynamically when your UI switches between content types that benefit from different checking behavior.
spellcheckBookmark these before your next form or editor.
true / false
Valuestextarea, input
ScopeRed underlines
BehaviorJS toggle
DynamicUsernames too
Practicetextarea, text-like input types, and any element with contenteditable. It is a global attribute but only affects editable content.textarea by default, but you should set true or false explicitly when the behavior matters.element.spellcheck = true or false using the boolean IDL property.Practice spellcheck="true" and false in the Try It editor.
5 people found this page helpful