String Length Calculator
Calculate string length in chars, bytes, and encodings.Runs in this tab.⌘ ↵ runs it
0
Characters
0
JS Code Units
0
UTF-8 Bytes
0
UTF-16 Bytes
0
Words
0
Lines
Next step
AtriumKitFrom the team behind browserutils
Turn a click-through into an interactive demo
AtriumKit records your web app once in Chrome and turns every click into a step of a demo you can embed or share. There’s a free plan.
Try AtriumKit freeAbout 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.
Comments
More in Text & String Utilities
- Word Counter
- Regex Tester
- String Case Converter
- Slug Generator
- Text Diff
- Lorem Ipsum Generator
- Line Sorter & Deduplicator
- Text Reverse
Comments