N        This expression returns the number of UTF-8 graphemes of the given text.

Whitespace qualifies as a grapheme, because although it's not visible content, it takes up display space. An emoji takes multiple UTF-8 code points, but displays as one grapheme.


For more details on UTF-8 terms like grapheme, read the Unicode notes topic.


Note that in HTML5, some browsers (including Firefox) do not support counting graphemes with built-in functions.

You can download a script to fill in this gap. For more details, see the platforms topic.