Network Byte Order Converter
Convert 16-bit and 32-bit integer values between network byte order (big-endian) and little-endian host byte order. View the reordered bytes, hexadecimal value and binary representation.
What Is Network Byte Order?
Network byte order is the conventional byte ordering used by many Internet and networking protocols for multi-byte integer fields. It is big-endian, meaning the most-significant byte appears first.
When a multi-byte integer is transferred between systems, byte-order conversion may be required if the host machine stores integers internally using a different endian arrangement.
Big-Endian Network Byte Order
In big-endian order, the highest-value byte appears at the lowest address or first position in the byte stream.
Network byte order: 12 34 56 78
The byte containing the most-significant bits, 0x12, appears first.
Little-Endian Byte Order
Little-endian systems store the least-significant byte first.
Little-endian memory bytes: 78 56 34 12
The individual bytes have not changed; only their order in memory or the byte sequence has changed.
Network to Host Byte Order Example
Suppose a four-byte network value arrives as:
On a little-endian host, the corresponding byte sequence becomes:
This is the basic byte-reversal operation performed by the calculator.
16-Bit Network Byte Order
A 16-bit integer contains two bytes. Converting between big-endian and little-endian simply swaps those two bytes.
Little endian: 34 12
For hexadecimal 0x1234, the byte-swapped representation is 0x3412.
32-Bit Network Byte Order
A 32-bit integer contains four bytes.
Little endian: 78 56 34 12
The conversion therefore reverses all four bytes.
Why Network Byte Order Exists
Different processor architectures can use different native byte ordering. If raw multi-byte integer memory were transmitted without an agreed convention, two machines could interpret the same bytes differently.
Using a standard network byte order provides a consistent representation for multi-byte protocol fields regardless of the sender’s internal CPU byte order.
Network Byte Order and IP Protocols
Networking software frequently encounters big-endian integer fields in Internet protocols and socket programming. Developers therefore often convert integer values between host byte order and network byte order when preparing or reading protocol fields.
The exact conversion needed depends on the host system’s native endian format.
Network Byte Order vs Modbus Byte Order
| Tool / Concept | Purpose |
|---|---|
| Network Byte Order | Convert big-endian network integers and little-endian host integers |
| Modbus Byte Order | Rearrange bytes and words used for multi-register Modbus values |
The Modbus problem may involve word swaps such as CDAB or byte swaps such as BADC. Network byte order is specifically the big-endian ordering used for network protocol integer representation.
Byte Order Does Not Change Individual Bytes
Endian conversion does not modify the binary content inside each byte. It changes only the sequence in which complete bytes appear.
Reverse: 78 56 34 12
For example, byte 0x56 remains 0x56 after conversion; it simply moves to another position.
Important Network Byte Order Notes
This calculator supports 16-bit and 32-bit unsigned integer patterns.
A 16-bit conversion swaps two bytes.
A 32-bit conversion reverses four bytes.
The input hexadecimal value must fit within the selected width.
This page displays the reordered hexadecimal sequence as a numerical value for convenience.
Host byte order is architecture-dependent; this calculator specifically uses little-endian as the host-side alternative.
The tool does not perform Modbus-specific word permutations.