Advanced

Endianness Byte-Swap Converter

Reverse the byte order of a hexadecimal value to convert between big-endian and little-endian representations.
Hexadecimal digits only; 0x prefix optional

Width

Number of bits in the value
Byte-swapped hex
0x12345678 → 0x78563412
Original hex
0x12345678
Original decimal
305,419,896
Swapped decimal
2,018,915,346
Byte count
4
185286120Original byte values (MSB → LSB)
Results are estimates for general information only and are not professional advice — always verify important results independently before relying on them. Read the full disclaimer.
Quick answer

How does this calculator work?

To swap endianness, write the value as full-width bytes and reverse their order: 0x12345678 (32-bit) becomes 0x78563412. This converts between big-endian and little-endian. The operation is its own inverse, so applying it twice restores the original value. Choose 16, 32, or 64 bits to match your data.

Formula
swap(b0 b1 ... bn-1) = bn-1 ... b1 b0 (reverse the w/8 bytes)
How this is calculated

Enter a hexadecimal value and choose its width: 16, 32, or 64 bits. The value is first cleaned (an optional 0x prefix, spaces, and underscores are removed) and then zero-padded on the left to the full width, so a 32-bit input always becomes 8 hex digits (4 bytes). The string is split into w/8 bytes, each one being a pair of hex digits.

Byte swapping simply reverses the order of those bytes. For example, the 32-bit value 0x12345678 has bytes [12, 34, 56, 78]; reversing them gives [78, 56, 34, 12], i.e. 0x78563412. This is exactly the bswap operation used when moving data between big-endian and little-endian systems, since the two orderings store the most-significant and least-significant bytes at opposite ends.

The original and swapped decimal values are computed with 64-bit-safe integer arithmetic, and the per-byte mapping shows how each source byte position moves to its destination (position i goes to position n-1-i). Note that the swap is its own inverse: applying it twice returns the original value. Inputs with more hex digits than the chosen width, or with non-hex characters, are rejected.

Frequently asked questions

Big-endian stores the most-significant byte first (at the lowest address), while little-endian stores the least-significant byte first. Converting between them means reversing the byte order, which is what this tool does.

No. A byte swap is its own inverse, so swapping a value and then swapping the result again returns the original value.

Byte swapping operates on a fixed-width value. A shorter hex string is padded on the left with zeros to fill the chosen width before its bytes are reversed.

Also known as

endianness converter
byte swap calculator
big endian little endian
byte order swap
bswap hex
endian converter
swap byte order
hex byte swap

APA

TG we-Calculate Editorial Team. (2026). Endianness Byte-Swap Converter [Online calculator]. TG we-Calculate. https://we-calculate.com/calculator/endianness-byte-swap-converter

Chicago

TG we-Calculate Editorial Team. "Endianness Byte-Swap Converter." TG we-Calculate. 2026. https://we-calculate.com/calculator/endianness-byte-swap-converter.

IEEE

TG we-Calculate Editorial Team, "Endianness Byte-Swap Converter," TG we-Calculate, 2026. [Online]. Available: https://we-calculate.com/calculator/endianness-byte-swap-converter

BibTeX

@misc{wecalculate_endianness_byte_swap_converter, title = {Endianness Byte-Swap Converter}, author = {{TG we-Calculate Editorial Team}}, howpublished = {\url{https://we-calculate.com/calculator/endianness-byte-swap-converter}}, year = {2026}, note = {TG we-Calculate} }

Did this calculator help you?