This project is not covered by Drupal’s security advisory policy.
MaxLength Words lets editors limit a text field by number of words instead of number of characters. It extends the MaxLength module with a live word counter and an optional hard word limit.
Features
- Adds a "MaxLength: count" option (Characters / Words) next to the existing MaxLength widget settings.
- A live word counter replaces MaxLength's character counter, with the same markup and styles (warning and error states).
- Reuses the MaxLength limit and counter message, so there is nothing new to learn.
- Milestones (5 words left, 0 left, limit exceeded) are announced to screen reader users.
- With "Hard limit" enabled, plain text inputs are trimmed while typing, and the limit is also enforced on form submit, including CKEditor 5 fields.
- HTML tags are not counted, and stand-alone punctuation such as
&or-is not a word. - Works with text (plain and formatted), text with summary, string and link widgets.
Typical use cases: summaries, teasers, abstracts, bios or captions where editorial guidelines are written in words ("max 50 words") rather than characters.
Post-Installation
There is no separate configuration page. Everything is set per field widget:
- Go to "Manage form display" of an entity bundle, for example Structure » Content types » Article » Manage form display.
- Open the settings of a supported widget.
- Set a MaxLength limit as usual, then set "MaxLength: count" to "Words".
- Save the widget settings and the form display.
Fields left on "Characters" (or "- None -") keep working exactly as with MaxLength alone.
Additional Requirements
- MaxLength 3.x
- Drupal 10.3 or 11
Recommended modules/libraries
None.
Similar projects
MaxLength counts characters only. This module does not replace it; it adds word counting on top of it, so existing MaxLength settings, styles and messages are reused.
Project information
- Project categories: Accessibility, Content editing experience
- Ecosystem: MaxLength
- Created by daniel.matcau on , updated
This project is not covered by the security advisory policy.
Use at your own risk! It may have publicly disclosed vulnerabilities.

