Quick answer
Text-to-hex conversion should first encode text into bytes, normally using UTF-8, and then write each byte as two hexadecimal digits. Converting back reverses the process: parse byte pairs and decode the resulting bytes with the same character encoding.
How to do it
- Choose UTF-8 unless a protocol explicitly requires another encoding.
- Convert every byte to a two-digit hex value, preserving leading zeros.
- When decoding, reject odd lengths and invalid characters before interpreting the bytes.
Characters are not always one byte
ASCII letters use one UTF-8 byte, but accented letters, CJK characters, and emoji use multiple bytes. Hex output therefore describes the encoded byte sequence rather than a simple list of Unicode code points.
Separators and prefixes
Tools may display spaces, colons, a 0x prefix, or one continuous string. These presentation choices are not usually part of the data. Normalize known separators deliberately and do not silently ignore arbitrary non-hex characters.
Common mistakes to avoid
- Dropping a leading zero from a byte.
- Treating Unicode code points as UTF-8 bytes.
- Guessing the character encoding of unknown binary data.
Try the related tool
Use QRFoundry directly in your browser. Tool inputs and uploaded files are processed on your device.
Open Text & Hex Converter