Endianness describes the order in which a computer stores the bytes of a multi-byte number. It is a frequent source of bugs when reading binary files, parsing network packets, or moving memory dumps between architectures. This tool reverses the byte order so you can convert between big-endian and little-endian instantly.
How it works
A hex value is split into bytes (pairs of hex digits). Swapping the endianness simply reverses the order of those bytes — the digits within each byte stay together:
- Big-endian: most significant byte first, e.g.
12 34 56 78. - Little-endian: least significant byte first, e.g.
78 56 34 12.
Before reversing, the value is zero-padded to whole bytes (and to your chosen width). This matters: 0x1234 stored in a 32-bit field is really 00 00 12 34, which swaps to 34 12 00 00, not 34 12.
Example
The 32-bit value 0x12345678 (big-endian bytes 12 34 56 78, decimal 305419896) swaps to little-endian 78 56 34 12, which read as an unsigned integer is 2018915346. Swapping again returns the original — the operation is its own inverse.
Notes
This is exactly what a CPU BSWAP instruction or the C functions htonl/ntohl perform. Use the width selector to match the actual field size in your data structure; padding to the wrong width is the most common cause of incorrect byte-swap results.