JavaScript String.length Online
Count JavaScript UTF-16 code units and compare the UTF-8 byte count.
Run details
The output updates as you type. The tool processes input in your browser.
Worked example
A visual character can contain multiple Unicode code points. Compare the text length and UTF-8 byte count when validating a storage limit.
A😀
3
JavaScript example
console.log("A😀".length);
Expected native output
3
Using this operation in JavaScript
The interactive result uses JavaScript. JavaScript string indexes count UTF-16 code units. Use code-point iteration when working with supplementary Unicode characters.