Characters
--
Free 路 Instant 路 No signup
Count Unicode characters, UTF-8 bytes via TextEncoder, and UTF-16 code units times two.
Page updated 2026-09-04.
Characters
--
UTF-8 bytes
--
UTF-16 bytes
--
'Hello - cafe 馃殌' has 14 characters, 17 UTF-8 bytes, and 30 UTF-16 bytes -- three genuinely different numbers for the same text, because different encodings represent the same characters using different numbers of bytes.
The gap between characters (14) and UTF-8 bytes (17) comes entirely from the rocket emoji 馃殌, which is a single character but requires 4 bytes to encode in UTF-8 -- most of this string's other characters (plain ASCII letters, spaces, a hyphen) each take just 1 UTF-8 byte, so the emoji alone accounts for most of the difference.
UTF-16 bytes (30) come out even higher because UTF-16 uses 2 bytes for most characters and, for a character like 馃殌 that's outside the Basic Multilingual Plane, needs a surrogate pair (2 code units, 4 bytes total) -- this is why the footer note specifically calls out that surrogate pairs count as two units in the UTF-16 column.
UTF-16 column is length * 2 (UCS-2 code units). Surrogate pairs count as two units. If you're checking a size limit for an API, database column, or file that's stored or transmitted as UTF-8 (extremely common for modern APIs and databases), UTF-8 byte count is the number that actually matters -- character count alone would understate the true storage size whenever emoji or other non-ASCII characters are present.
If you're working with JavaScript string.length or certain database column types historically defined in UTF-16 code units, the UTF-16 byte figure (or its underlying code-unit count) is the more relevant number, since JavaScript's native string length property counts UTF-16 code units, not actual characters, for characters outside the Basic Multilingual Plane.
Plain ASCII text (English letters, digits, common punctuation) has identical character count and UTF-8 byte count, since each ASCII character is exactly 1 byte in UTF-8 -- the three numbers only diverge meaningfully once accented characters, non-Latin scripts, or emoji enter the text.
If a size limit is expressed in a broader unit (KB, MB) rather than raw bytes, the General Data Storage Unit Converter handles that conversion.
For converting the same text into its raw binary or hex byte representation rather than just counting bytes, the Binary to Text/ASCII Converter is the related tool.
The rocket emoji 馃殌 is a single character but requires 4 bytes to represent in UTF-8, while most other characters in this string (plain ASCII letters and punctuation) each take just 1 UTF-8 byte -- the emoji alone contributes disproportionately to the total byte count.
It depends on the column's actual storage encoding -- for a UTF-8-encoded column (the common case for modern databases), use the UTF-8 byte count, since that reflects the actual storage space the text will consume, which character count alone would understate for non-ASCII text.
UTF-16 column is length * 2 (UCS-2 code units). Surrogate pairs count as two units. UTF-16 uses 2 bytes for most characters, and for characters outside the Basic Multilingual Plane (like this emoji), it needs a surrogate pair -- two 2-byte code units, or 4 bytes total for that single character -- pushing the overall UTF-16 byte count higher than the UTF-8 equivalent for text containing such characters.
It's closest to (though calculated differently from) the UTF-16 code-unit count, since JavaScript strings are internally UTF-16 encoded and .length counts code units, not true characters -- a character requiring a surrogate pair counts as 2 toward .length, not 1.
Yes. Plain ASCII characters (standard English letters, digits, common punctuation) are exactly 1 byte in UTF-8, so character count and UTF-8 byte count are identical for pure ASCII text. The numbers only diverge once accented characters, non-Latin scripts, or emoji are included.
Port Number Lookup & Common Services Guide Tool Map a TCP/UDP port to a common service name and IANA range class.
JSON to CSV / Excel Converter Flatten a JSON array of objects into a CSV table with a header row.
CSP (Content Security Policy) Header Builder Assemble a Content-Security-Policy header from default-src, script-src, and style-src.
Unix File Permission (Chmod) Octal Calculator Build a chmod octal and rwxr-xr-x symbolic string from owner, group, and other bits.