UTF-8 Encoding Guide

UTF-8 Encoding Guide

The variable-width byte encoding used by most of the web, with one to four bytes per code point.

How UTF-8 counts bytes

UTF-8 is a variable-width encoding: ASCII code points U+0000 through U+007F use one byte, two-byte sequences cover most Latin and Greek letters, three-byte sequences cover common CJK characters, and four-byte sequences cover astral code points above U+FFFF.

The byte patterns are designed so no byte of a multi-byte sequence can be mistaken for an ASCII character.

A41
éC3 A9
E2 82 AC
😀F0 9F 98 80

ASCII compatibility

Every ASCII character keeps its exact single-byte value in UTF-8. That is why old ASCII tools and protocols can usually pass UTF-8 text through without corrupting basic letters and numbers.

UTF-8 is the default encoding for HTML, JSON, URLs, and most modern web and command-line tools.

Reading UTF-8 in a character detail page

Each character page in this hub lists its UTF-8 bytes as space-separated hex values. The euro sign, for example, is E2 82 AC, which is the three-byte encoding of U+20AC.

Use the URL-encoded form when you need percent-encoded text, such as %E2%82%AC for the same euro sign.