Skip to main content
Byte Array Tools

Byte Array to Hex Converter

Convert a byte array to a hex string, with or without spaces, colons, commas or 0x prefixes, in upper or lower case. Signed Java bytes are handled correctly.

Paste decimal bytes, including negative Java-style values, and get a compact hex string in the layout you need.

Decimal values (0-255, or -128 to -1 for signed bytes), binary, or a code array such as new byte[] {...}.

Negative values such as -1 are signed bytes - they become FF, the same eight bits read as unsigned.

What Is the Byte Array to Hex Converter?

It converts a list of byte values into a hexadecimal string - the compact form used for hashes, keys, MAC addresses and protocol dumps. You choose the separator (none, space, colon or comma), upper or lower case, and whether each byte gets a 0x prefix.

When to Use It

  • Turning Arrays.toString(bytes) output from Java, which prints signed numbers, into readable hex.
  • Comparing a byte array from code with a hex value in documentation.
  • Formatting bytes as a fingerprint such as AB:CD:EF.

How to Use It

  1. Paste the bytes: decimal values from 0 to 255, signed values from -128 to -1, binary, Base64 or a code array.
  2. Choose the separator, case and prefix.
  3. Copy the hex.

Example

The Java output [-54, -2, -70, -66, 0, 1, 127, -128] becomes CA FE BA BE 00 01 7F 80. A signed byte of -54 is the same eight bits as the unsigned value 202, which is CA in hex.

Understanding the Output

Each byte always becomes exactly two hex digits, with a leading zero where needed (1 becomes 01), so the string can be split back into bytes without separators.

Limitations

Values outside -128 to 255 are rejected, since they do not fit in a byte. For the opposite direction use Hex to Byte Array; to see text as hex, use the Text to Hex Converter.

Frequently Asked Questions

Negative values are signed bytes, as Java prints them. The eight bits of -1 are the same as the unsigned value 255, which is FF in hex, and -54 is the same as 202, which is CA. The hex shows the actual bits.

Both mean the same value. Lower case is common in hashes and most programming languages (sha256 output, Python hex()), while upper case is common in hardware documentation and MAC addresses. Match whatever you are comparing against.

In Java 17 and later, use HexFormat.of().formatHex(bytes). In older versions, loop over the bytes and use String.format("%02x", b & 0xFF) - the & 0xFF avoids sign problems with negative bytes.
Share this tool: