ASCII: hello
The text hello has 5 UTF-16 code units, 5 Unicode code points, 5 graphemes and 5 UTF-8 bytes. For this ASCII example, all four measurements agree.
Processed locally
Calculate string length, Unicode code points, graphemes, UTF-8 bytes and words in your browser. Leading and trailing whitespace is trimmed; internal spaces and line breaks are counted.
Overview
String Length Online counts JavaScript UTF-16 code units, Unicode code points, visible graphemes, UTF-8 bytes and words as you type. Compare these totals before applying a character or byte limit. Measurements use trimmed input: leading and trailing whitespace is removed, while internal whitespace stays in the text.
Workflow
Follow the core workflow below. Use “Show in tool” to locate the real control in the live tool above.
Enter the text in Text to analyze. The metrics update live as you type or paste.
Text to analyzeUse Total characters, Characters, and Word count for the basic view. The current tool ignores leading and trailing whitespace before calculating the metrics.
Total charactersCharactersWord countJavaScript length counts UTF-16 code units. Unicode code points and Visible graphemes give Unicode-aware views, while UTF-8 bytes shows encoded byte size.
JavaScript lengthUnicode code pointsVisible graphemesUTF-8 bytesYou can now use the measurement that matches the runtime, UI, storage, or payload limit you are debugging.
Practical cases
The text hello has 5 UTF-16 code units, 5 Unicode code points, 5 graphemes and 5 UTF-8 bytes. For this ASCII example, all four measurements agree.
One 😀 has JavaScript length 2, but only 1 Unicode code point and 1 grapheme. Its UTF-8 encoding uses 4 bytes. Choose the measurement that matches your limit.
Troubleshooting
From evidence to action
Use the measured value with the target runtime or storage limit when asking a coding agent to diagnose truncation, validation, encoding, or normalization behavior.
Developer guides
Understand the concept, inspect a testable example, then open it in the tool above.
FAQ