Back to Tools

Text Length Calculator

Processed Locally

Calculate text length in various units: characters, bytes, UTF-8 bytes, UTF-16 code units, Unicode code points, and grapheme clusters. Understand how text is measured differently.

Frequently Asked Questions

JavaScript's string.length counts UTF-16 code units, which can give incorrect counts for emoji and special characters. Unicode code points count the actual number of characters. For example, "👋" is length 2 in JavaScript but 1 code point.
Grapheme clusters are user-perceived characters. For example, "👋🏽" (waving hand with skin tone) is 1 grapheme cluster but 4 UTF-16 code units and 2 Unicode code points. This is the most accurate count of "visible characters".
UTF-8 and UTF-16 are different encodings for the same characters. UTF-8 uses 1-4 bytes per character (efficient for English), while UTF-16 uses 2 or 4 bytes. JavaScript strings use UTF-16 internally, but files/networks often use UTF-8.
It depends on your use case: Grapheme clusters for user-visible character count, UTF-8 bytes for file/network size, UTF-16 code units for JavaScript string operations, and Unicode code points for proper character counting including emoji.