You can add a word or character counter to a WordPress form with a form plugin that has a length limit setting, or with a few lines of custom code. WPForms and Ninja Forms can limit by words or characters. Gravity Forms limits characters in core and adds word limits through a paid add-on. Contact Form 7 and Fluent Forms limit characters only.
Which one you need depends on what you are collecting. A short bio box wants a hard cap. A scholarship essay wants a visible counter so people can pace themselves. This guide compares what each plugin does today, shows how to set it up, and gives you example code for when a plugin falls short.
Word limit or character limit?
The two limits solve different problems, so pick the right one before you pick a plugin.
- Character limit. Best when the text lands somewhere with a fixed size: a database field, a name badge, a short summary, an SMS. It is simple, and it is what most form plugins support.
- Word limit. Best when you judge length the way a person reads it: essays, testimonials, applications, bios. Word counts are fairer across languages and typing styles than character counts.
- Counter shown to the visitor. A live “120 of 300 words” message means nobody gets a surprise error after pressing Submit.
- Minimum limits. Some forms need a floor as well, for example reviews that must say something useful. Not every plugin supports minimums, so check before you commit.
Form plugins compared
| Plugin | Limit type | Live counter | Notes |
|---|---|---|---|
| WPForms | Characters or words | Yes | Limit Length option on Single Line Text and Paragraph Text |
| Ninja Forms | Characters or words | Yes | Restrictions settings; Paragraph Text needs the rich text editor off |
| Gravity Forms | Characters in core; words via Gravity Perks | Characters in core | Maximum Characters setting; word limits need the Word Count perk |
| Contact Form 7 | Characters | Yes, with the count tag | Free; maxlength and minlength options on text and textarea tags |
| Fluent Forms | Characters | Not documented | Max Text Length on the Text Area field |
Plans and availability change, so check the vendor’s feature page before you buy a form plugin for this alone.
WPForms
WPForms is a drag-and-drop form builder. Its length limit works on the Single Line Text and Paragraph Text fields.
- Open the form in the builder and click the text field.
- Go to the Advanced tab in the field options.
- Turn on Limit Length.
- Enter a number and choose Characters or Words.
- Save the form.
Visitors see how many characters or words are allowed and how many they have used, and once the limit is reached they cannot type more. When you limit by characters, spaces and punctuation count too. WPForms documents the feature without naming a plan, so confirm what your licence level includes.
Ninja Forms
Ninja Forms puts length limits in a field’s Restrictions settings. They are available on Single Line Text and Paragraph Text, along with a few other field types.
- The Restrictions tab shows only when Developer Mode is on in the Ninja Forms settings.
- Set a character or word limit, and edit the text that follows the live counter, for example “Words left”.
- On a Paragraph Text field, character and word restrictions work only when the rich text editor is turned off.
That last point catches people out. If the counter does not appear, check the rich text setting first.
Gravity Forms
Gravity Forms has a Maximum Characters setting on the Paragraph Text field. If a submission goes over, the form does not submit and an error appears on the field. When the rich text editor is on, HTML tags are stripped before counting, so only visible text counts.
For word limits, Gravity Wiz sells Word Count as part of Gravity Perks. It sets a minimum, a maximum or both on Single Line Text, Paragraph and Post Body fields, stops typing at the maximum, and enforces the limit on pasted text. It is a commercial add-on, so you need Gravity Forms and the perk.
Contact Form 7
Contact Form 7 is free and minimal, and its limits are written into the form markup. Text, textarea, email, URL and phone tags accept maxlength and minlength options. A separate [count] tag, given the same name as the field, shows the number of characters typed. Add down to show the characters remaining instead.
[textarea* your-message maxlength:500 minlength:50]
[count your-message down]
Contact Form 7 counts characters, not words. For a word limit you need custom code, shown below, or a separate add-on. Check the add-on’s page before installing, because several word counter plugins for Contact Form 7 have not been updated for years.
Fluent Forms
Fluent Forms has a Max Text Length option under the Text Area field’s advanced settings. It limits characters. Its text area documentation does not describe a word limit option, so for words you would add code like the example below.
Which option should you pick?
- You already use one of these plugins. Check its settings first. WPForms and Ninja Forms cover most needs without code.
- You need words, and you use Contact Form 7 or Fluent Forms. Use the example code below rather than switching plugins for one field.
- You use Gravity Forms and need minimum and maximum words. The Word Count perk is built for it.
- You only need a character cap. Every plugin in this guide handles that, and the browser’s own
maxlengthattribute on a textarea does it with no plugin at all. - The limit protects something important. Add server-side validation whatever plugin you choose.
Add a word counter with custom code
When your plugin lacks a word limit, a short script does the job. This works with any form builder that lets you add a CSS class to the field.
- Add the CSS class
js-word-limitto the textarea field in your form builder. In Contact Form 7, useclass:js-word-limiton the tag. - Set a limit with a
data-max-wordsattribute where your builder allows custom attributes, or keep the default in the script below. - Add the script with a code snippets plugin or your child theme’s
functions.php, not by editing a plugin or the parent theme.
Example code, which prints a counter under each marked field and trims text that goes over the limit:
add_action( 'wp_footer', function () {
?>
<script>
document.addEventListener( 'DOMContentLoaded', function () {
var max = 200;
document.querySelectorAll( 'textarea.js-word-limit, .js-word-limit textarea' ).forEach( function ( box ) {
var note = document.createElement( 'p' );
box.insertAdjacentElement( 'afterend', note );
function update() {
var words = box.value.trim().split( /\s+/ ).filter( Boolean );
if ( words.length > max ) {
box.value = words.slice( 0, max ).join( ' ' );
words = words.slice( 0, max );
}
note.textContent = words.length + ' of ' + max + ' words';
}
box.addEventListener( 'input', update );
update();
} );
} );
</script>
<?php
} );
Trimming a long paste to the limit may surprise people, so many sites show the message and only block on submit. Change the behavior to suit your form.
Validate on the server too
A script in the browser is a convenience, not a guarantee. Anyone can switch JavaScript off or post straight to the form endpoint. If the limit matters, enforce it on the server as well. For Contact Form 7, the plugin lets you validate a field with a filter. Example code:
function my_limit_message_words( $result, $tag ) {
if ( 'your-message' === $tag->name ) {
$text = isset( $_POST['your-message'] ) ? wp_unslash( $_POST['your-message'] ) : '';
$words = preg_split( '/\s+/', trim( $text ), -1, PREG_SPLIT_NO_EMPTY );
if ( count( $words ) > 200 ) {
$result->invalidate( $tag, 'Please keep your message to 200 words or fewer.' );
}
}
return $result;
}
add_filter( 'wpcf7_validate_textarea', 'my_limit_message_words', 20, 2 );
add_filter( 'wpcf7_validate_textarea*', 'my_limit_message_words', 20, 2 );
Other builders have their own validation hooks, described in each plugin’s developer documentation. Back up your site and try any snippet on a staging copy before it goes live.
Design tips that make limits work
- Say the limit in the label. “Tell us about your project (up to 200 words)” avoids a surprise.
- Show the counter near the field, not at the bottom of the page.
- Warn before you block. Turn the counter a different color as people near the limit.
- Make errors specific. “You are 14 words over” beats “Invalid input”.
- Test on a phone. Mobile keyboards and autocorrect change what gets typed, and the counter must stay visible above the keyboard.
- Keep the counter accessible. Screen readers should be told about limits through the label or help text, not only through a counter that updates silently.
Where word limits show up on community sites
Word and character limits matter well beyond contact forms. Member bios, job applications, course feedback, event submissions and directory listings all take free text. If you run a community or membership site, set limits where long text would break a layout or overload moderators. Our guide to building an online community covers the surrounding setup, and the LMS plugin roundup is useful if your forms feed a course site. If you are still choosing a stack, try the community picker.
Frequently asked questions
Which WordPress form plugin has a word counter built in?
WPForms and Ninja Forms both let you limit a text field by words and show a live counter. Gravity Forms needs the paid Word Count perk for words, while Contact Form 7 and Fluent Forms limit characters.
Can Contact Form 7 count words?
Not on its own. Its count tag and maxlength option work on characters. For words, use custom code or an add-on, and check the add-on is still maintained.
Is a character limit enough for essays?
Usually not. People think in words, and a character cap can cut a sentence mid-word. Use a word limit for essays, or give a character cap generous room.
Do I need code to add a word limit?
Not if your plugin supports it. WPForms and Ninja Forms offer it in field settings. Code is only needed for plugins that limit characters only.
Can people bypass a limit set in the browser?
Yes. A browser script can be disabled or skipped by posting directly to the form. If the limit matters, validate the length on the server as well.
How do I add a minimum word count?
Some tools support it. Gravity Perks Word Count accepts a minimum, and Contact Form 7 has a minlength option for characters. Otherwise add a check in server-side validation.
Should I put the limit in the field label?
Yes. Naming the limit up front, such as “up to 200 words”, prevents error messages after Submit.
Try it on a full site
To see forms, member profiles and listings working together on a finished site, open the Reign demos. For a complete setup, follow the community build guide.