What the page shows

UTF-8 is the encoding that stores Unicode text as bytes in files, web pages and network messages. This page makes those bytes visible. The default text é gives C3 A9, two bytes. The letter A gives 41, and the euro sign gives E2 82 AC. In decode mode you enter hex pairs separated by whitespace and get text back, which is helpful when a log, a packet capture or a hex dump shows only bytes. It answers questions such as why a file is larger than its character count, or why a database field rejects certain input.

How UTF-8 is built

UTF-8, specified in RFC 3629, uses one to four bytes per scalar value. Code points up to U+007F use one byte, identical to ASCII, which is why plain English text has the same size in ASCII and UTF-8. Up to U+07FF use two bytes, up to U+FFFF use three, and up to U+10FFFF use four. The leading bits of the first byte tell a reader how long the sequence is: 0 for one byte, 110 for two, 1110 for three and 11110 for four. Continuation bytes always begin with 10. For é, U+00E9 is 11101001 in binary, which fits into the pattern 110xxxxx 10xxxxxx as 11000011 10101001, or C3 A9.

Worked byte patterns

Four characters cover all lengths. The letter A is U+0041 and encodes as 41. The letter é is U+00E9 and encodes as C3 A9. The euro sign is U+20AC and encodes as E2 82 AC. The grinning face emoji is U+1F600 and encodes as F0 9F 98 80. The word café therefore has four characters and five bytes. A page in Greek, Russian or Hebrew uses two bytes for most letters, and Chinese, Japanese and Korean text uses three for most characters. Storage limits expressed in bytes, such as a 255-byte database field, can hold fewer characters than the same limit in characters. A 255-byte field holds 255 English letters but only 85 characters of three-byte text, and an emoji-heavy message fills it after 63 emoji. Checking the byte count before saving avoids truncated or rejected entries.

Decoding hex bytes

In decode mode, enter pairs of hexadecimal digits separated by spaces, tabs or line breaks, such as E2 82 AC, which returns the euro sign. Each pair must have exactly two digits, so 5 must be written as 05, and the pairs must not include 0x prefixes or commas. The bytes then have to form valid UTF-8. A sequence can fail even when every pair is valid hex: a lone C3, a continuation byte A9 without a lead byte, or a lead byte followed by the wrong number of continuations are all malformed. The page reports an error rather than substituting the replacement character. Many programs insert the character U+FFFD, which hides the damage, while an error tells you exactly that the data is broken. Hex case does not matter on input, so c3 a9 and C3 A9 decode the same, but the output always uses capitals.

Overlong forms and invalid sequences

UTF-8 forbids more than one encoding of the same scalar. The byte pair C0 80 would be an overlong way to write NUL, and a strict decoder rejects it, as this page does. Bytes in the range ED A0 80 through ED BF BF would represent surrogates, which are not valid scalar values, and values above U+10FFFF cannot be encoded at all. Rejecting these cases is a security feature, since lenient decoders have historically allowed attackers to hide slashes and dots inside overlong sequences. If you see unexpected errors on data from an old system, the data may be in Latin-1 or Windows-1252 instead.

Composed and decomposed text

The page does not normalize text. The letter é typed as a single character encodes as C3 A9, but the same letter written as e followed by a combining acute accent (U+0301) encodes as 65 CC 81, three bytes. The two strings look identical on screen but differ in bytes, so a file name, password or database key can fail to match depending on how it was typed. macOS file systems historically stored decomposed names, while many other systems use composed text. Comparing the hex output of two strings is a reliable way to find such a difference.

Byte order marks and other invisible bytes

Some editors prepend the three bytes EF BB BF to a UTF-8 file as a signature. UTF-8 has no byte order issue, so this is optional, and many tools do not expect it. It can appear as a stray character at the start of a CSV header or break a script's first line. Other invisible bytes include E2 80 8B for a zero-width space and C2 A0 for a non-breaking space. Encoding the suspicious text here shows which bytes are present, and removing them is then a matter of editing the source or setting the editor to save without a signature. HTTP responses declare the encoding in a Content-Type header, so a charset mismatch there, not a file problem, often explains garbled characters on a web page.

Connections to other pages

The Unicode converter on this site shows the code points that lead to these bytes, so the two pages together explain both layers, from the abstract number to the stored bytes. The Base64 and percent-encoding pages operate on the same UTF-8 bytes: the percent encoding of é is %C3%A9, which is the same bytes C3 A9 written with percent signs. The ASCII converter lists decimal codes for the first 128 characters, which are the single-byte range of UTF-8. Moving between these views is useful in protocol work, where the same byte string is presented in hex, decimal, Base64 or escaped text depending on the tool.

Encoding rejections and decoding failures for UTF-8 bytes

Input is processed in your browser and limited to 1 MiB of UTF-8 text. Text with unpaired surrogates is rejected on encoding. On decoding, malformed or non-hex input is rejected and no replacement characters are inserted. The page does not normalize Unicode, detect other encodings, or guess whether bytes are text at all. Arbitrary binary data such as images or compressed files will usually not decode as UTF-8. The output is text or hexadecimal only, so use a hex editor for general binary work.