Hexadecimal represents each byte with two digits. It is a convenient inspection format for payloads that are awkward to print.
Worked example
payload = bytes([0, 15, 255])
print(payload.hex(' '))Result
00 0f ffImplementation notes
A hexadecimal string is typically twice the byte length. A column sized for the binary payload may be too short for its printable representation.
Try it yourself
Include a zero byte and round-trip the result with bytes.fromhex.
Open the Python example →Editorial date September 11, 2025 · Published December 6, 2026