Skip to content

Home

Byte size of string

Returns the length of a string in bytes.

const byteSize = str => new Blob([str]).size;

byteSize('😀'); // 4
byteSize('Hello World'); // 11

More like this

Start typing a keyphrase to see matching snippets.