Skip to content

String Length Calculator

Embed

Paste this where you want String Length Calculator on your site. Adjust the height to fit.

<iframe src="https://www.browserutils.dev/embed/string-length-calculator/" width="100%" height="500" frameborder="0" loading="lazy" title="String Length Calculator"></iframe>
<p style="font-size:12px;margin:4px 0 0"><a href="https://www.browserutils.dev/tools/string-length-calculator/">String Length Calculator</a> by BrowserUtils</p>

Calculate string length in chars, bytes, and encodings.Runs in this tab.

0
Characters
0
JS Code Units
0
UTF-8 Bytes
0
UTF-16 Bytes
0
Words
0
Lines

Next step

About String Length Calculator

Free online string length calculator. Get the length of any string in characters, bytes, UTF-8, and UTF-16 encoding units. It runs in your browser. Nothing is sent to a server.

Questions

Why are character count and byte count different?
Characters and bytes differ because multi-byte encodings like UTF-8 use more than one byte for non-ASCII characters. For example, an emoji might be 1 character but 4 bytes in UTF-8.
What encodings does the string length calculator support?
The tool shows lengths in JavaScript characters (UTF-16 code units), Unicode code points, UTF-8 bytes, and UTF-16 bytes so you can plan for different storage and transmission contexts.
How do I check if my string fits a database column size?
Check the byte count for your database encoding (usually UTF-8). A VARCHAR(255) column in MySQL with UTF-8 encoding allows 255 bytes, which may be fewer than 255 characters if non-ASCII text is present.
Does the string length calculator count emoji correctly?
Yes, the tool shows both the JavaScript .length value (which counts UTF-16 code units) and the true Unicode code point count. Some emoji are 2 code units in JavaScript but 1 visible character.

More in Text & String Utilities

All 28 text & string utilities