Skip to main content
Byte Array Tools

UTF-8 Encoder / Decoder

Encode text to UTF-8 bytes and decode UTF-8 bytes to text, with a per-character table of code points, byte counts and bit patterns.

See how UTF-8 stores each character - one byte for ASCII, up to four for emoji - and find invalid sequences in broken text.

Garbled text such as "é" instead of "é" usually means UTF-8 bytes were read as Latin-1 - decode the bytes here to confirm.

What Is the UTF-8 Encoder / Decoder?

UTF-8 is the text encoding used by almost every web page, API and modern file. It stores each character in one to four bytes. This tool encodes text to UTF-8 bytes and decodes bytes back to text, and shows a table with each character's Unicode code point, its UTF-8 bytes and the bit pattern used.

When to Use It

  • Fixing mojibake - text like Café where Café was expected.
  • Working out why a string's byte length is larger than its character count.
  • Checking whether a byte sequence is valid UTF-8.

How to Use It

  1. Choose Encode text or Decode bytes.
  2. Type the text, or paste the bytes in hex, decimal or \x form.
  3. Read the result and the per-character table.

Example

ñ ₹ 😀 日本 encodes to C3 B1 20 E2 82 B9 20 F0 9F 98 80 20 E6 97 A5 E6 9C AC. The table shows ñ (U+00F1) as 2 bytes with the pattern 110xxxxx 10xxxxxx, the rupee sign (U+20B9) and each Japanese character as 3 bytes, and the emoji (U+1F600) as 4 bytes.

Understanding the Output

The first byte of each character tells you its length: 0xxxxxxx is one byte, 110xxxxx starts two, 1110xxxx three and 11110xxx four; continuation bytes always start with 10. When decoding, bytes that break these rules are reported as invalid and shown as �.

Limitations

The table lists the first 500 characters. The tool works with UTF-8 only - for UTF-16 or Latin-1, use the String to Byte Array Converter. For code point escapes such as ñ, use the Unicode Code Point Converter.

Frequently Asked Questions

One byte for ASCII (U+0000 to U+007F), two bytes up to U+07FF (most accented Latin, Greek, Cyrillic, Arabic, Hebrew), three bytes up to U+FFFF (most other scripts, including Hindi, Chinese and Japanese) and four bytes above that (emoji and rare characters).

That is UTF-8 read as Latin-1 or Windows-1252. The two UTF-8 bytes of é (C3 A9) were interpreted as two separate characters. Make sure the file, the database connection and the HTTP Content-Type all use UTF-8.

A continuation byte (10xxxxxx) without a start byte, a start byte not followed by enough continuation bytes, overlong encodings, or values outside the Unicode range. Such bytes are reported and shown as the replacement character.

The byte order mark EF BB BF sometimes appears at the start of UTF-8 files created on Windows. UTF-8 does not need it, and it can break scripts, CSV headers and JSON parsers. It decodes to the invisible character U+FEFF.
Share this tool: