Wiki · Read the guide: Data formats and endianness

Data Format Inspector

Paste a sequence of hex bytes and read it at once as an integer (8/16/32/64-bit, signed and unsigned) and as an IEEE-754 single/double float, in big and little endian. For floats, the sign, exponent and mantissa decomposition; plus the inverse path, from a value back to bytes.

Data format and endianness inspector

1 · Raw bytes

Free separators (spaces, commas, colons, dashes) and 0x prefixes are ignored. The offset picks the first byte to interpret.

2 · Inverse: value → bytes

Interpretations

Type Big-endian Little-endian
int8 — —
uint8 — —
int16 — —
uint16 — —
int32 — —
uint32 — —
int64 — —
uint64 — —
float32 — —
float64 — —

IEEE-754 decomposition

How it works

What is endianness (big and little)?

The same bytes in memory represent different numbers depending on the order you read them. In big-endian the most significant byte comes first, in little-endian last: the sequence 0x01 0x00 is 256 in big-endian and 1 in little-endian. x86/ARM machines are little-endian; many network protocols and binary formats use big-endian (network byte order).

How do signed integers work?

Signed integers use two’s complement: the most significant bit carries negative weight. For an N-bit value:

v=−bN−1 2N−1+∑i=0N−2bi 2i,v = -b_{N-1}\,2^{N-1} + \sum_{i=0}^{N-2} b_i\,2^{i},intervallo [−2N−1,  2N−1−1]\text{intervallo } [-2^{N-1},\; 2^{N-1}-1]

The negative of a number is the bitwise complement plus one. The unsigned form reads the same N bits as a non-negative integer in [0, 2ᴺ−1]: this is why 0xFF is −1 as int8 but 255 as uint8.

How are IEEE-754 floats encoded?

Floats follow the IEEE-754 standard. A value is encoded in three fields: a sign bit s, an exponent e stored with a bias (127 for the 32-bit single, 1023 for the 64-bit double) and a mantissa m. For normal values:

v=(−1)s (1+m) 2 e−bias,v = (-1)^{s}\,\bigl(1 + m\bigr)\,2^{\,e - \text{bias}},m=∑i=1pb−i 2−im = \sum_{i=1}^{p} b_{-i}\,2^{-i}

The 32-bit single has 1 sign bit, 8 exponent bits and 23 mantissa bits; the 64-bit double has 1 + 11 + 52. The mantissa has an implicit leading 1 (the "hidden bit") for normal numbers. The exponent edge cases encode zero and subnormals (all-zero exponent) and infinity/NaN (all-one exponent).

When is this tool useful?

Reading a 16- or 32-bit register from a datasheet, decoding a binary protocol frame (Modbus, CAN, a UDP payload), figuring out why a float saved by a board arrives "swapped" on the PC: in all these cases the byte order and the encoding are what matter. Seeing every interpretation in parallel makes it immediate to spot which type and endian matches the expected value.