Ambimat GroupAmbimatAmbiSecureSIMAuthAmbiAutomationEngineering BlogAhmedabad · India · Est. 1982
Encoding utility

HEX ↔ Byte-Array

Paste hex in any reasonable form (0x90, 0x00, 9000, 90:00, \\x90\\x00). Get back the same bytes formatted for C, Java, Python, JavaScript, escape-string, or canonical hex with your choice of separator.

Client-sideMulti-format inputCopy-friendly

Input

Result

Type something to convert.
All conversion runs locally.

What does this tool do?

Logs from PC/SC, Wireshark, gpshell, OpenSC, etc. all use slightly different hex formats. This tool normalises and re-emits in the format your code expects.

ASCII pairing

Need text-to-hex?

ASCII ↔ HEX →

Companion tool

Decode an APDU you just normalised.

APDU parser →

Endian flip

Need to swap byte order?

Endian converter →

Formatting and counting hex bytes

Hex strings turn up everywhere in smart-card and crypto work — keys, APDUs, TLV payloads, hashes — but they arrive in inconsistent shapes: run-together, space-separated, comma-separated, or 0x-prefixed. This tool normalises a hex string into clean byte pairs, counts the bytes, and re-formats it the way your next tool expects.

Worked example: 0A0B0C is three bytes and formats to 0A 0B 0C. A valid hex byte string must have an even number of hex digits — an odd length (for example 0A0) is ambiguous and is rejected, which usually means a digit was dropped when copying.

Frequently asked questions

Why does an odd number of hex digits fail?

Each byte is exactly two hex digits, so a valid byte string is always even-length. An odd count means a digit is missing — recheck the source.

What byte count should I expect for a key or hash?

A SHA-256 value is 32 bytes (64 hex chars); an AES-128 key is 16 bytes. The byte counter helps confirm you pasted the whole value.

Does anything leave my browser?

No. Formatting and counting happen locally.

Why does my byte array show negative numbers in Java?

Java's byte type is signed, so any value above 0x7F appears negative. The underlying byte is unchanged; only the display differs, which is why 0xFF reads as -1.

Does byte order matter when converting hex to an array?

Not for the conversion itself, which preserves the sequence exactly. It matters when those bytes are interpreted as a number, where little-endian and big-endian give different results from the same array.