UTF-8 Converter

See the UTF-8 bytes behind any text in six notations, and turn a list of bytes back into readable text.

Input
Output
Runs locally in your browser

About the UTF-8 Converter

UTF-8 is a variable length encoding: ASCII characters take one byte, most European and Middle Eastern letters take two, the majority of East Asian characters take three, and emoji take four. Almost every encoding bug comes from something in the pipeline assuming a fixed width, and the fastest way to find that assumption is to look at the actual bytes.

Seven modes cover the ways those bytes get written down. Hexadecimal pairs match a hex dump or a database blob. Decimal values match a byte array in Python or Java. The \xNN form pastes into source code, and the percent form matches what appears in a URL or a server log. Code points in U+ notation are what you look up in the Unicode charts, and the table mode lines up character, code point, decimal value and byte sequence in columns so a single problem character stands out.

The decode mode runs the other way. Paste bytes as spaced hex, as decimal numbers, with 0x or \x prefixes, or as percent escapes, and the text comes back. This is the mode that diagnoses mojibake: if café arrived as café, decoding the bytes shows the classic C3 A9 pair being read one byte at a time by something expecting Latin-1.

For escape sequences aimed at JavaScript or JSON, Unicode Escape produces the \uXXXX form instead.

How to use

  1. Paste text, or a list of byte values if you want to go the other way.
  2. Choose a mode in Convert to, from hex bytes to the per character table.
  3. Select Bytes back to text to decode hex, decimal or percent escapes into readable text.

Common questions

How many bytes does an emoji take in UTF-8?
Four. Emoji live above the basic plane, which is why systems that assume two bytes per character mangle them.
What does it mean when café shows as café?
UTF-8 bytes are being read as Latin-1. The two bytes C3 A9 are shown as two separate characters instead of one é.
Which byte formats can the decode mode read?
Spaced or continuous hex, decimal numbers, 0x and \x prefixed values, and percent escapes copied from a URL.
Is UTF-8 the same as Unicode?
No. Unicode assigns a number to each character, and UTF-8 is one way of storing those numbers as bytes.