String Length Calculator
Use our free online string length tool to convert get the length of strings or unicode strings.
How To Use The String Length Calculator
In programming you may find the time where you need to calculate the length of a string. You can use this tool to quickly find a length of a string, or to compare against your own calculations as a reference.
How we calculate the Length of a String
Toolflow accounts for unicode characters, and will give you the length you expect. This even applies to Chinese characters. However, we also return the size of the string in bytes so you can see how large your string is.
See a few examples below:
'Toolflow'.length // 8 Characters (8 Bytes) 'こんにちは'.length // 5 Characters (15 Bytes) '£100'.length // 4 Characters (5 Bytes)
.length on a string value to get its length:
let myString = 'Hello, world!'; console.log(myString.length); // Outputs 13
To get the size of a string in bytes, we can convert the string into a Blob. Then once we have a blob we can simply call
.size to get the size of the string in bytes.
You won't see much difference with regular letters and numbers, as these only take up 1 byte. However, try entering a special character or characters using other input methods.
let myString = '你好'; let sizeInBytes = new Blob([inputValue.value]).size; console.log(sizeInBytes); // Outputs 6