FormatterHQ

Byte to String

Decode a list or array of byte values into text. Works with decimal, hex and signed Java bytes, and with brackets, commas or spaces as separators.

Loading tool…
Ready.

How to use the Byte to String

  1. Type or paste into the Bytes box, or click Sample. You can also drop a text file on either box, or load one into the Bytes box with its Open file button.
  2. The Text box updates live as you type. It works both ways — edit the Text side to convert back, or click ⇄ Swap to exchange the sides.
  3. Adjust Decode notation in the options bar above the editors; the result refreshes immediately. Byte list only affects the reverse direction, when you type in the Text box.
  4. Use Copy or Download on either box to take the result, or Clear to start again.

Byte to string decoding

Debuggers and logs often print binary data as a list of numbers: [72, 101, 108, 108, 111]. The byte to string converter reads those numbers as bytes and decodes them as UTF-8 text, so you can see the message hidden in the array.

Accepted input

  • Decimal values from 0 to 255.
  • Negative values from −128 to −1, as printed by Java, Kotlin or C# sbyte; they are converted by adding 256.
  • Hex values when Decode notation is set to Hex, or individual values written with 0x.
  • Separators: spaces, commas, semicolons and line breaks. Brackets, braces and parentheses are ignored, so array literals from most languages paste straight in.

Example

Input:

[72, 101, 108, 108, 111, 32, -61, -87, 116, -61, -87]

Output:

Hello été

The pairs -61, -87 are the signed form of 195, 169 — the UTF-8 bytes of “é”.

Where byte arrays come from

  • Java’s Arrays.toString(bytes) and Kotlin’s contentToString().
  • Node.js Buffer and Uint8Array output in the console.
  • Python list(b"...") output, or bytes stored as JSON arrays by an API.
  • Serial monitors and embedded debug output for microcontrollers.

If you are unsure whether a list holds bytes or code points, look at the range: values above 255 can only be code points, while negative values can only be signed bytes. A list with many values between 128 and 255 in pairs or triples is almost always UTF-8.

Decoding bytes in code

Java: new String(bytes, StandardCharsets.UTF_8). C#: Encoding.UTF8.GetString(bytes). Python: bytes([72, 105]).decode("utf-8") (negative values must first be converted with b % 256). JavaScript: new TextDecoder().decode(new Uint8Array([72, 105])). Always name the character set explicitly: platform defaults vary and are a classic cause of garbled text.

Troubleshooting

  • “Byte values must be between -128 and 255”. A value is out of range, which usually means the numbers are Unicode code points rather than bytes. Use ASCII to Text for code points.
  • Replacement characters (�). The bytes are not valid UTF-8 — they may be binary data, or text in another encoding.
  • Wrong characters in hex mode. Make sure the notation matches the input; “10” is sixteen in hex but ten in decimal.

Convert text into bytes with String to Byte Array, or decode Unicode code points with ASCII to Text. Everything runs in your browser.

Convert bytes to string in Python

In Python a bytes object becomes text with .decode("utf-8"). The classic mistake is calling str() on it, which returns the representation b'Hello \xc3\xa9t\xc3\xa9' rather than the text. For a list of numbers, wrap it in bytes() first; values must be 0 to 255, so signed bytes copied from Java raise ValueError until you apply % 256. Add errors="replace" when the data may not be valid UTF-8, otherwise decode() raises UnicodeDecodeError.

data = b"Hello \xc3\xa9t\xc3\xa9"

print(str(data))               # the repr, not the text
print(data.decode("utf-8"))    # Hello été

# a list of numbers, including signed Java bytes
values = [72, 101, 108, 108, 111, 32, -61, -87, 116, -61, -87]
text = bytes(value % 256 for value in values).decode("utf-8")
print(text)

# bytes that are not valid UTF-8
print(b"caf\xe9".decode("utf-8", errors="replace"))

The converter above decodes the same signed list to the same text, a quick way to confirm what an array holds before you write the byte to string code.

Frequently asked questions

How do I convert a Java byte array to a string?
Paste the output of Arrays.toString() — negative values included — into the Bytes box. In code, use new String(bytes, StandardCharsets.UTF_8).
What is the difference between bytes and character codes?
Bytes are 0–255 and a non-ASCII character may take several of them in UTF-8. Character codes (code points) can be much larger, for example 8364 for €.
Can I paste hex bytes?
Yes. Set the byte notation to Hex, or prefix each value with 0x.
Why are negative numbers allowed?
Java, Kotlin and some other languages use signed bytes, so values above 127 appear as negative numbers. The tool adds 256 to recover the original byte.

Last updated October 3, 2026

Related tools