Byte decoding

Bytes to String Converter

Decode byte values into text locally in your browser. Unlike bytes-to-GB math, byte-to-string conversion requires a character encoding.

Decoded 5 bytes locally as UTF-8.

Convert bytes to string in Python

Python bytes objects expose decode(). For UTF-8 data:

data = bytes([72, 101, 108, 108, 111])
text = data.decode("utf-8")
print(text)  # Hello

For hexadecimal input:

text = bytes.fromhex("48 65 6c 6c 6f").decode("utf-8")

Bytes are not characters by themselves

A byte is an 8-bit numeric value. A character encoding maps sequences of bytes to text. That is why storage conversion such as bytes to GB is pure arithmetic, while bytes to string is decoding.

Bytes to string FAQ

Can bytes be converted to a string without knowing the encoding?

Not reliably. Bytes are numeric data; text requires an agreed character encoding such as UTF-8.

How do I convert bytes to a string in Python?

For UTF-8 bytes, call data.decode("utf-8"). The correct encoding must match the bytes that produced the data.

What happens if the bytes are not valid UTF-8?

A strict UTF-8 decoder reports an error. Choose the correct encoding instead of silently changing invalid data.

Conversion history
Stored only on this device.