UTF-8 Explained
This Unicode to UTF-8 converter online maps characters to UTF-8 byte sequences for debugging APIs, file encodings, and i18n tests. UTF-8 (8-bit Unicode Transformation Format) is a variable-length character encoding for Unicode and a type of prefix code. See UTF-8 on Wikipedia and the Unicode Standard.
It can encode all valid Unicode code points using one to four bytes. Since lower-value code points are generally used more frequently, encoding everything with a fixed width would be inefficient and wasteful of memory.
UTF-8 was designed for backward compatibility with ASCII. The first 128 Unicode characters are encoded using a single byte with the same binary values as ASCII, making them byte-for-byte identical. This means software that originally handled ASCII can continue to work with little or no modification.
Unicode to UTF-8 Converter Workflow
Use this page as a Unicode to UTF-8 converter:
- Paste text or a single character into the input
- View the Unicode code point (per MDN
codePointAt) - Inspect the UTF-8 byte sequence in binary and hex
- Copy results for debugging APIs, file encodings, or i18n tests
Batch paste is supported for short strings; very long input may be truncated in the preview for performance.
UTF-8 Code Point Prefix Table
| Number of bytes | Bits for code point | First code point | Last code point | Byte 1 | Byte 2 | Byte 3 | Byte 4 |
|---|---|---|---|---|---|---|---|
| 1 | 7 | U+0000 | U+007F | 0xxxxxxx | |||
| 2 | 11 | U+0080 | U+07FF | 110xxxxx | 10xxxxxx | ||
| 3 | 16 | U+0800 | U+FFFF | 1110xxxx | 10xxxxxx | 10xxxxxx | |
| 4 | 21 | U+10000 | U+10FFFF | 11110xxx | 10xxxxxx | 10xxxxxx | 10xxxxxx |
The 128 ASCII characters require only one byte. Latin characters with diacritics, Greek letters, etc., require two bytes. Most commonly used characters in the BMP (including most CJK characters) use three bytes. Characters in supplementary planes (such as emoji) use four bytes.
Encoding Process
- Convert the character to its Unicode code point (e.g.,
str.codePointAt(0)) - Determine the number of bytes needed based on the prefix table
- Apply the appropriate prefix and fill in the code point bits from right to left
- Group every eight bits to produce the UTF-8 byte sequence
For example, "道" has code point 0x9053, requiring three bytes. With the prefix 1110xxxx 10xxxxxx 10xxxxxx, filling in the bits yields 11101001 10000001 10010011, which is E9 81 93.