UTF-8
A variable-length Unicode encoding. The dominant character encoding on the web, used by over 98% of websites.
UTF-8 is a variable-length character encoding for implementing Unicode. RFC 3629 (November 2003, Internet Standard STD 63) defines it as encoding the characters from U+0000 to U+10FFFF as sequences of 1 to 4 bytes, maintaining full ASCII compatibility (letters, digits, and symbols) while representing the characters in the Unicode repertoire. In the W3Techs usage survey, 99.0% of the websites whose character encoding is known used UTF-8 as of August 2026, making it the de facto standard character encoding on the web.
UTF-8 byte counts vary by character type. ASCII (U+0000-U+007F) uses 1 byte, extended Latin and Cyrillic (U+0080-U+07FF) use 2 bytes, Japanese/Chinese/Korean characters including kanji, hiragana, and katakana (U+0800-U+FFFF) use 3 bytes, and emoji and some CJK characters (U+10000-U+10FFFF) use 4 bytes. This variable-length design allows English text to be stored at ASCII size while efficiently representing multilingual text.
UTF-8 became the web standard for several reasons. Its ASCII compatibility means existing ASCII-based protocols (HTTP, SMTP, URL) and tools work unchanged. It has no byte order (endianness) issues and requires no BOM (Byte Order Mark). It also features self-synchronization, allowing character boundaries to be identified from any point in the byte stream, making it resilient to data corruption.
In HTML, character encoding is declared with <meta charset="UTF-8">. Without this declaration, browsers may misidentify the encoding, causing garbled text. It can also be specified via the HTTP response header Content-Type: text/html; charset=utf-8, and declaring both keeps the declaration effective even when the file is opened on its own.
Database handling of UTF-8 requires attention. MySQL's utf8 is an alias of utf8mb3, a character set that handles at most 3 bytes per character and therefore cannot store 4-byte characters (like emoji). As of August 2026, the 8.4 reference manual lists both this alias and utf8mb3 itself as deprecated and expected to be removed in a future major release. To store all Unicode characters including emoji, utf8mb4 must be used. PostgreSQL's UTF8 supports 4 bytes from the start.
For character counting, understanding the difference between UTF-8 byte count and character count is important. "Hello" is 5 characters and 5 bytes in UTF-8, but "こんにちは" is 5 characters yet 15 bytes (3 bytes × 5 characters). Since database column sizes and file size limits are often specified in bytes, knowing both character count and byte count is necessary. Displaying both in character counting tools helps users handle various constraints.