UTF-8 Encoder and Decoder

Show the exact UTF-8 bytes behind any text in hex, percent-encoded or escaped form, and decode those bytes back into characters. The tool is free, instant and runs in your browser without uploading anything.

UTF-8 Encoder and DecoderPrivate · runs on your device
Input
Words 0Characters 0Lines 0
Result

Example: € → E2 82 AC

How to use the UTF-8 encoder and decoder

Choose how you want the bytes written, and the tool does the rest as you type.

  1. Type or paste into the Input box. Any character works, from plain letters to emoji and right-to-left scripts.
  2. Set Mode to Encode to see bytes, or Decode to turn bytes back into characters.
  3. When encoding, pick a Byte format: Hex bytes (E2 82 AC), Percent (%E2%82%AC) or Escaped (\xE2\x82\xAC). One format is shown at a time, so switch the select to see another.
  4. When decoding, paste bytes in any of those three styles. The tool accepts 0x prefixes too.
  5. Press Copy, Download .txt or Use as input.

Decoding strips every character that is not a hex digit, so keep the input clean. If the bytes are not valid UTF-8 you will see replacement characters. The counters under the input box count characters, not bytes, so the byte total is the number of hex pairs in the output.

How UTF-8 encodes characters

UTF-8 stores each Unicode code point in one to four bytes. The leading bits of the first byte say how long the sequence is, and every following byte starts with 10.

Code pointsBytesPatternExample
U+0000 to U+007F10xxxxxxxA is 41
U+0080 to U+07FF2110xxxxx 10xxxxxxé is C3 A9
U+0800 to U+FFFF31110xxxx 10xxxxxx 10xxxxxx€ is E2 82 AC
U+10000 and above411110xxx then three 10xxxxxx😀 is F0 9F 98 80

The three byte formats suit different places. Percent form is what URLs and form submissions use. Escaped form is what string literals in C, shell printf and Python byte strings use. Plain hex is what debuggers and network dumps print. Byte counts differ from character counts. Café has four characters but five bytes, 43 61 66 C3 A9, and the two Japanese characters 日本 take six, E6 97 A5 E6 9C AC.

Worked example: the euro sign is U+20AC, binary 0010 000010 101100. Slot those 16 bits into the three-byte pattern and you get 11100010 10000010 10101100, which is E2 82 AC. See the same bytes as bits in the binary translator.

Diagnosing encoding problems

Seeing the bytes explains many odd symptoms. Text such as é where é belongs is mojibake: the two bytes C3 A9 were read as Latin-1, where C3 is à and A9 is ©. Byte size matters for databases and APIs too, because a limit of 255 bytes holds fewer characters once accents or emoji appear. Invalid input shows clearly: decoding C3 28 gives a replacement character followed by (, and E2 82 alone gives one replacement character, because the sequence is incomplete.

A subtler case is the same visible letter stored two ways. é can be the single code point C3 A9, or an e followed by a combining accent, which is 65 CC 81, three bytes. The Unicode text converter shows code points, and the hex to text converter is a simpler view when you only need hex.

Other encodings, and what this tool covers

UTF-16 uses two bytes for most characters and four for emoji, and is the internal form in Windows, Java and JavaScript. UTF-32 uses four bytes for everything. Latin-1 and Windows-1252 are single-byte encodings for Western European text and are the usual source of mojibake. This tool shows UTF-8 only; it does not produce UTF-16 or Latin-1 bytes, and it does not add a byte order mark (EF BB BF), which is optional in UTF-8. For percent-encoded text inside links see the URL encoder.

UTF-8 won on the web because it is compact for Latin text, compatible with ASCII and able to represent every Unicode character. Its structure also makes it self-synchronising: because continuation bytes always begin with 10, a reader that lands in the middle of a character can find the next boundary, which is why a single damaged byte usually spoils only one character.

Quick answers

Frequently asked questions

The questions people ask most, answered in plain words.

What is UTF-8 encoding?

UTF-8 is the standard way of storing Unicode text as bytes. Each character takes one to four bytes depending on its code point, and plain ASCII characters stay as single unchanged bytes. It can represent every character in every language and is used by most websites.

How many bytes is a character in UTF-8?

Between one and four. English letters, digits and common punctuation take one byte. Accented Latin letters, Greek, Cyrillic, Hebrew and Arabic take two. Most Chinese, Japanese and Korean characters and the euro sign take three. Emoji take four. Paste a character to see its length.

Why does my text show characters like é instead of é?

That is mojibake. The letter é is two bytes in UTF-8, C3 A9. If a program reads those bytes as Latin-1, each byte becomes its own character, giving à and ©. The fix is to tell the program that the data is UTF-8.

What is the difference between Unicode and UTF-8?

Unicode is the catalogue that gives every character a number, called a code point. UTF-8 is one way of writing those numbers as bytes in a file or over a network. UTF-16 and UTF-32 are alternatives. The character is the same; only the bytes differ.

How do I decode UTF-8 bytes back to text?

Set Mode to Decode and paste the bytes as hex pairs, as percent codes or as backslash-x escapes. The tool reads them as UTF-8 and shows the characters. If a sequence is incomplete or invalid, a replacement character marks the problem.