returns a string by decoding the data in the byte array ba, assuming UTF-8 encoding.


interprets the data in the specified character encoding.



open allclose all

Basic Examples  (2)

Create a string from a ByteArray, assuming it contains UTF-8 data:

Create a string from a ByteArray, interpreting the data as ISO 8859-7 Latin/Greek:

Scope  (2)

Convert ASCII bytes of English capital letters to a string:

Compare different character encodings:

Applications  (1)

Import a webpage:

Extract the bytes of the page in a ByteArray object:

Convert the UTF-8 encoded data to a string:

Display the first five lines of the raw page:

Properties & Relations  (5)

All bytes can be represented in ISO8859-1:

The characters produced in this encoding have code points 0 to 255:

The length of the string generated is less than or equal to the length of the byte array:

An empty byte array produces an empty string:

An empty list is accepted as a synonym for an empty byte array:

ByteArrayToString[str] decodes UTF-8 bytes to a string representation:

FromCharacterCode[bytes] converts code points to a string:

ByteArrayToString is the inverse of StringToByteArray:

Possible Issues  (1)

Not all byte sequences are valid UTF-8 codes:

Invalid bytesin this case 162are interpreted as literal code points:

Converting the string back to a byte array produces a different but valid UTF-8 byte sequence:

Wolfram Research (2017), ByteArrayToString, Wolfram Language function,


Wolfram Research (2017), ByteArrayToString, Wolfram Language function,


Wolfram Language. 2017. "ByteArrayToString." Wolfram Language & System Documentation Center. Wolfram Research.


Wolfram Language. (2017). ByteArrayToString. Wolfram Language & System Documentation Center. Retrieved from


@misc{reference.wolfram_2024_bytearraytostring, author="Wolfram Research", title="{ByteArrayToString}", year="2017", howpublished="\url{}", note=[Accessed: 20-July-2024 ]}


@online{reference.wolfram_2024_bytearraytostring, organization={Wolfram Research}, title={ByteArrayToString}, year={2017}, url={}, note=[Accessed: 20-July-2024 ]}