Encoding Tools
UTF-8 encoder & decoder.
Type text to see its UTF-8 bytes, or switch direction and paste bytes to decode them. Every character gets its own row, and malformed UTF-8 is reported byte by byte instead of being silently repaired. Nothing leaves your browser.
How it works: UTF-8 writes each Unicode code point in 1 to 4 bytes. ASCII stays one byte (A is 41); é is C3 A9; € is E2 82 AC; the emoji 😀 (U+1F600) is F0 9F 98 80. Decoding reverses it and rejects sequences RFC 3629 does not allow.
Inputs
Result
How UTF-8 encoding works
UTF-8 is a variable-width encoding of the Unicode code points U+0000 to U+10FFFF. RFC 3629 section 3 defines four layouts, and the bits marked x carry the code point:
| Code point range | Byte pattern | Bytes |
|---|---|---|
| U+0000 to U+007F | 0xxxxxxx | 1 |
| U+0080 to U+07FF | 110xxxxx 10xxxxxx | 2 |
| U+0800 to U+FFFF | 1110xxxx 10xxxxxx 10xxxxxx | 3 |
| U+10000 to U+10FFFF | 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx | 4 |
Worked example. The euro sign is U+20AC, which is 0010 0000 1010 1100 in binary. It needs the 3-byte pattern, so the 16 bits are split 0010 | 000010 | 101100 and dropped into the x positions: 11100010 10000010 10101100, which is E2 82 AC.
What counts as invalid. A decoder must refuse sequences that the format does not allow. RFC 3629 section 10 warns about overlong forms such as C0 80 (a two-byte spelling of U+0000) and about encoded surrogates, because parsers that accept them have been exploited. The Unicode Standard (Table 3-7, “Well-Formed UTF-8 Byte Sequences”) fixes the exact byte ranges: for example E0 must be followed by A0..BF, ED by 80..9F, F0 by 90..BF and F4 by 80..8F, and C0, C1 and F5..FF never occur. This page checks every byte against those ranges and shows the offset of each problem.
Replacement. After a problem, the decoded text shows one U+FFFD per bad sequence, following the “maximal subpart” practice in chapter 3 of the Unicode Standard. Browsers' TextDecoder follows the WHATWG Encoding Standard, which replaces bad input the same way for the cases tested here, so the text matches what a web page would display.
Sources: RFC 3629, UTF-8 (sections 3, 4 and 10), The Unicode Standard, chapter 3 (Conformance) (Table 3-7) and the WHATWG Encoding Standard, retrieved October 2026. Related: the binary converter explains how text becomes bits.
Frequently asked questions
What is the difference between UTF-8 encoding and decoding?
Encoding turns characters into bytes: each Unicode code point becomes 1 to 4 bytes. Decoding reads bytes and rebuilds the characters. Use the Encode direction to see the bytes for text, and the Decode direction to read bytes you were given.
How many bytes is a character in UTF-8?
ASCII characters (U+0000 to U+007F) take 1 byte, most accented Latin, Greek, Cyrillic, Hebrew and Arabic letters take 2, most other characters in the Basic Multilingual Plane (including € and most CJK) take 3, and characters from U+10000 up, such as most emoji, take 4.
Why does my UTF-8 decode show the replacement character?
The bytes were not valid UTF-8. The most common causes are text that was really in another encoding (such as Latin-1), data cut off in the middle of a character, or bytes edited by hand. The list under the output names the offset and the rule that was broken.
Is C0 80 valid UTF-8?
No. It is an overlong encoding of U+0000. RFC 3629 forbids it and warns that parsers which accept it can be fooled into letting through characters a filter meant to block.
Does this tool send my text anywhere?
No. Encoding and decoding run in your browser with plain JavaScript. Nothing is uploaded, logged or stored.