Byte to String

Decode byte arrays into strings and encode strings as byte arrays.

0 chars
0 words
0 lines
0 chars
0 words
0 lines

Byte to String Converter – Byte Array to String and Back

Convert a byte array into a readable string, or a string into a byte array you can paste into code. The tool understands the formats that programming languages actually print: [72, 101, 108] from Python or JavaScript, Java's signed -61 style bytes, and hex lists like 48 65 6C, and decodes them with the character encoding you choose.

Bytes to String

Paste the bytes in almost any format – with or without brackets, separated by commas or spaces, decimal or hex. Whole code literals such as byte[] bytes = { 72, 105 }; or new Uint8Array([72, 105]) work too, so the swap button round-trips cleanly. The sample [72, 101, 108, 108, 111, 32, -61, -89, …] is what Java's Arrays.toString(bytes) prints for UTF-8 text; negative values are converted to unsigned bytes (-61 → 195) and the result decodes to Hello çalışan 👋. Choose the Character encoding that produced the bytes:

  • UTF-8 – the default for web, Linux, JSON, and most modern APIs.
  • Latin-1 / Windows-1252 – single-byte legacy encodings from older databases, Windows programs, and CSV exports.
  • UTF-16 LE / BE – two-byte units used internally by Windows, Java, .NET, and JavaScript strings.

String to Bytes

The reverse direction encodes your text and formats the bytes as ready-to-use code:

  • JavaScript – new Uint8Array([72, 105])
  • Python – bytes([72, 105])
  • Java – byte[] bytes = { 72, 105 }; with signed values above 127
  • C#, C, and Go – byte[], unsigned char[], and []byte{} literals

Switch the number base to hexadecimal for 0x48-style output. In Java hex mode, bytes above 0x7F get a (byte) cast so the code compiles.

Typical situations

Debugging an HTTP client that returns a byte array, checking what a serial device sent, writing a unit test with a fixed payload, porting code between languages, or figuring out why a string looks wrong after it passed through a byte buffer. If you only see garbled characters like ç, the text was probably decoded with the wrong encoding – UTF-8 Decode can repair it. For raw bytes that include control characters, use Byte to ASCII.

Frequently Asked Questions

Java's byte type is signed and ranges from -128 to 127, so any byte above 127 is printed as a negative number: 0xC3 (195) becomes -61. This tool accepts those negative values and converts them back to unsigned bytes before decoding, and the Java output format produces signed values that compile without casts.

Both use one byte per character and agree on almost everything, except bytes 128–159. Latin-1 treats them as invisible control characters, while Windows-1252 maps them to useful symbols such as € (128), curly quotes (145–148), and the en dash (150). Text from Windows applications and old web pages is usually Windows-1252 even if it is labelled Latin-1.

UTF-16 stores most characters as a 16-bit unit. LE (little-endian, used by Windows and .NET) writes the low byte first, so 'A' is 65, 0; BE (big-endian) writes 0, 65. Emoji use two 16-bit units, so they take four bytes.

The bytes are not a complete UTF-8 sequence – they may be cut off in the middle of a character, come from a binary file, or use another encoding. Try Windows-1252 or Latin-1, which accept every byte value.