Text Encoding Converter Online — Hex / Binary / Unicode / UTF-8 / ASCII

Hex bytes / 8-bit Binary / Unicode \uXXXX / UTF-8 decimal bytes / ASCII decimal codes

Input
Output

About Text Encoding Conversion

This tool converts text both ways among five encodings: Hexadecimal (Hex) turns text into the hex form of its UTF-8 bytes (2 digits per byte, space-separated, e.g. "A" → "41"); Binary turns text into the 8-bit binary form of its UTF-8 bytes (space-separated, e.g. "A" → "01000001"); Unicode turns text into the \uXXXX format (4 hex digits, e.g. "A" → "\u0041"); UTF-8 turns text into a decimal byte sequence (space-separated, e.g. "中" → "228 184 173"); ASCII turns ASCII characters (code points 0-127) into decimal codes (space-separated, e.g. "A" → "65"). For URL percent-encoding, use the URL encoder/decoder.

The Five Encodings Explained

Hexadecimal (Hex)

The text is UTF-8 encoded into bytes, and each byte becomes 2 hex digits (00-FF), space-separated. The byte order matches the text’s UTF-8 encoding — handy for browser packet capture, binary file comparison and viewing hash values.

Binary

The text is UTF-8 encoded into bytes, and each byte becomes 8 binary digits (00000000-11111111), space-separated. Useful for understanding low-level storage, debugging bitwise operations and analyzing network protocols.

Unicode Code Points

Each character’s Unicode code point is turned into the 4-digit hex \uXXXX format. Note that non-BMP characters (such as Emoji) are shown downgraded as the two \u escapes of a surrogate pair. Useful for JavaScript string escaping and CSS iconfont codes.

UTF-8 Decimal Bytes

After UTF-8 encoding, each byte is shown in decimal (0-255), space-separated. It is essentially the same as Hex/Binary (all are UTF-8 bytes), differing only in the numeric base — handy for users less familiar with hexadecimal.

ASCII Decimal Codes

ASCII characters (code points 0-127, covering upper/lower-case letters, digits, common punctuation and control characters) are shown as decimal codes. Input containing non-ASCII characters (such as Chinese or Emoji) raises an error. Useful for ASCII-table lookup and character conversion when debugging code.

FAQ

What is the difference between Hex and UTF-8 encoding?

They express the same thing in different bases: Hex shows each UTF-8 byte in hexadecimal (00-FF), UTF-8 shows it in decimal (0-255). For example, the UTF-8 bytes of the Chinese character "中" are [228, 184, 173] (decimal) = [E4, B8, AD] (hex). You can convert between the two with a radix converter first.

Why is a Chinese character six characters in Hex encoding?

In UTF-8 a Chinese character occupies 3 bytes, and each byte becomes 2 hex digits → 6 digits. For example, "你" → E4 BD A0 (3 bytes × 2 hex digits/byte = 6 digits). English letters and digits usually take 1 byte = 2 hex digits.

Why does ASCII encoding fail with Chinese input?

The ASCII standard only covers characters 0-127 (English letters, digits, punctuation, control characters). Chinese code points are far above 127 and outside ASCII. To handle Chinese, use Hex / Binary / UTF-8 / Unicode encoding.

How does encoding differ from encryption/compression?

Encoding is a format change that does not alter the information and is losslessly reversible (e.g. Hex ↔ text). Encryption requires a key, and the output is completely different from the input. Compression shrinks the data but is not directly readable. For Base64, use the Base64 encoder/decoder.