Endianness Swapper

Reverse byte order to convert between big-endian and little-endian hex.

Free endianness swapper. Paste a hex value and reverse its byte order to convert between big-endian and little-endian, choosing 16, 32 or 64-bit width, with the unsigned integer value of each form. Runs in your browser. It runs free in your browser on Gera Tools, with nothing uploaded.

Last updated Source: Gera Tools

What is endianness?

Endianness is the order in which the bytes of a multi-byte value are stored. Big-endian puts the most significant byte first; little-endian puts the least significant byte first. The bit order inside each byte never changes.

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, with no installation required.

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.

Worked 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.

When you need this

Endianness mismatches show up in a surprising number of places:

  • Network programming — TCP/IP uses big-endian (network byte order), but most desktops run on little-endian x86. The standard C functions htonl, htons, ntohl, and ntohs perform exactly this swap before sending or after receiving an integer.
  • Binary file formats — TIFF images support both endiannesses (marked by the magic bytes II or MM). ELF binaries, BMP files, and many proprietary formats require knowing the byte order before parsing multi-byte fields.
  • Embedded debugging — when you read a register value from a JTAG debugger or a logic analyser capture, the bytes may appear in a different order than the CPU’s native word representation.
  • Cross-platform data exchange — a binary struct serialised on an ARM device may need a bswap before being interpreted on an x86 server.

Choosing the right width

Width padding is the most common source of wrong results. A value like 0x1234 is two bytes, but if it lives inside a 32-bit register or a protocol field defined as a uint32_t, the four-byte context matters:

Padded to 32 bits:   00 00 12 34
After byte swap:     34 12 00 00   → 0x34120000 = 873857024

Swap the raw two bytes instead and you get 34 120x3412 = 13330 — a completely different number. Always match the width to the actual field size in your structure.

What the CPU does

This is exactly what the BSWAP instruction performs on x86 and the equivalent on ARM (REV, REV16). The tool runs the same logic locally in your browser — nothing is uploaded, and it works offline once the page has loaded.