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
- Why does a Chinese character become six hexadecimal digits?
- A common Chinese character occupies 3 UTF-8 bytes, which become 6 hexadecimal digits because each byte uses 2 digits. An ASCII letter usually occupies just 1 byte. This tool converts the encoded bytes of text rather than treating the entire input as an integer. The output length therefore depends on the character encoding and the actual characters, rather than only on the number of visible symbols.
- Can hexadecimal text decoding accept 0x prefixes and commas?
- This tool accepts 0x prefixes, whitespace, and commas when decoding hexadecimal text. After removing those separators, every 2 hexadecimal digits must form 1 byte in the range 00 through FF. An odd number of digits cannot form complete bytes. The resulting bytes must also be valid UTF-8, so correct the source data if byte grouping succeeds but the decoded sequence is rejected as text.
- Why is hexadecimal 41 different from the text 41?
- The hexadecimal byte 41 decodes to the letter A, while encoding the text 41 produces 3431. The first case contains 1 byte, and the second contains 2 ASCII characters before encoding. Choose the operation based on what the input represents. Confusing textual digits with byte notation changes the underlying data, so matching appearances are not enough to establish that two inputs should produce identical results.
Related tools