Documentation

gwp_length

The gwp_length Gravity Forms Merge Tag Modifier to count the number of characters. This can be handy to check if the number of characters is in line with the publishing rules for where you want to show or use the text.

:gwp_length

Examples

{text:1:gwp_length}
Example valueModifier result
GravityWP9
GravityWP Advanced Merge Tags29
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.123
Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur?865

Frequently Asked Questions

How do I count characters from a Paragraph Text field in Gravity Forms?

The :gwp_length modifier lets you count the number of characters entered into a field. It works great for Paragraph Text or Single Line Text fields when you want to validate or display character length after form submission.

Example:
{Your Message:1:gwp_length}

Can I use :gwp_length in confirmation messages?

Yes! You can display the number of characters submitted by a user right inside the confirmation message. It’s useful for feedback forms, content submission rules, or just a friendly stat.

Example:
Thank you! You wrote {Your Message:1:gwp_length} characters.

Will :gwp_length count spaces and punctuation?

3. Will :gwp_length count spaces and punctuation?
Absolutely. The :gwp_length modifier uses mb_strlen() behind the scenes, which counts all characters including spaces, punctuation, and special characters accurately and UTF-8 safe.

Example:
If a user writes “Hello world!”, it will return: 12
{Your Message:1:gwp_length}

What field types are supported with :gwp_length?

You can use this modifier with Paragraph Text and Single Line Text fields. It won’t work on fields that don’t produce a standard string value (like checkboxes or lists).

Example:
{Text Field:3:gwp_length}

How do I verify if the modifier works correctly?

Simply preview your form, fill in the targeted field, and submit it. The confirmation should display the correct character count. In our test, a 50-character sentence was counted perfectly with this setup.

Example output:
Input: “You don't have to be beautiful to turn me on!”
Confirmation: “Thank you! You wrote 50 characters.”

Last updated: 21-07-2025

Advanced Merge Tagsv1.9.3

To use the functionalities described in this documentation, you'll need to get the GravityWP - Advanced Merge Tags add-on.

Read more