Toolstia / Endianness converter
endianness converter
Enter a number in hex or decimal and see its bytes in big endian and little endian order, the value with the bytes swapped, and both signed and unsigned readings.
Big endian stores the most significant byte first, which is how people write numbers and how network protocols send them. Little endian stores the least significant byte first, which is what x86 and most ARM computers use in memory. Swapping the byte order converts between the two. Negative decimals are read as two's complement.
How it works
- Type the number and pick hex or decimal.
- Choose 16, 32 or 64 bits.
- Read the byte order in each endianness and the swapped value.
Big and little endian
Big endian puts the most significant byte first, as network protocols do. Little endian puts the least significant byte first, as x86 and most ARM computers do in memory.
Swapped value
Reading the little endian bytes as if they were big endian gives the swapped value, which is what ntohl and htonl calculate.
Signed numbers
Negative decimals are stored in two-complement form. The tool shows both the unsigned and signed reading of the result.
Example
0x12345678 is stored as 12 34 56 78 in big endian and 78 56 34 12 in little endian.
Questions
Is my number uploaded?
Everything happens in your browser, and nothing you enter is sent anywhere.
What if my number is shorter than the width?
It is padded with zeros on the left, so 0xAB in 16 bits is 00 AB.
Does it handle 64 bit values exactly?
Yes. It uses exact big integers, so there is no rounding.