Hex ↔ text
Convert UTF-8 text and hex byte sequences both ways
Choose a separator, letter case and prefix before encoding. Decoding accepts whitespace, commas and 0x; the remaining digit count must be even.
Example
Input
A中
Example result
41 e4 b8 ad
Use lowercase, spaces and no prefix. UTF-8 bytes differ from a character's Unicode number.
Technical details & limits
One byte is two hex digits, from 00 to FF. ASCII letters normally occupy one UTF-8 byte and common Han characters three. After removing 0x prefixes, whitespace and commas, decoding requires an even number of digits and valid UTF-8. It does not treat the input as a single integer.
About this tool
Convert text to UTF-8 hexadecimal bytes and back. Choose uppercase, separators and 0x prefixes; decoding checks characters and byte length for protocol debugging and encoding diagnostics.
Use cases
- See the actual bytes a piece of text carries on the wire.
- Recover a readable string from a `0x` byte list pasted in a config.
- Diagnose an encoding issue (UTF-8 vs GBK vs ISO-8859-1) by inspecting bytes.
How to use
- Paste text (or hex) into the input.
- Choose separator (none / space / comma) and whether to add a `0x` prefix.
- Click Encode for hexadecimal bytes or Decode to restore UTF-8 text.
Notes
Decoding permits 0x prefixes, whitespace and commas. Other non-hex characters are rejected and the remaining digit count must be even.
FAQ
- Is `0xE4` different from `E4`?
- No — `0x` is just a prefix. Both decode to byte 0xE4.
- Does case matter on decode?
- No. Both `A-F` and `a-f` are accepted.
- Why does e4 b8 fail to decode to 中?
- The final ad byte is missing. UTF-8 uses variable-length sequences; truncating one makes decoding fail.
- Why does one Han character produce several hex pairs?
- This tool represents UTF-8 bytes, not Unicode code-point numbers. Each hex pair is one byte, and one character may encode to several bytes.
Related tools