Reading a hex address one byte at a time
Two hex digits make one byte. An IPv4 address holds four bytes, so eight digits. Take 0A000032:
- Split into pairs. 0A, 00, 00, 32.
- Convert each pair. Multiply the first digit by 16, add the second. A counts as 10, so 0A is 10. 32 is 3 × 16 + 2 = 50.
- Join with dots. 10.0.0.50.
The byte strip in the converter shows each pair in decimal and binary. Binary helps when you check where a /20 or /27 boundary falls inside an octet.
| Hex pair | Decimal | Where you see it first |
|---|---|---|
0A | 10 | Leading byte of the 10.0.0.0/8 private block |
64 | 100 | Leading byte of 100.64.0.0/10 carrier NAT |
7F | 127 | Loopback, 127.0.0.1 |
AC | 172 | Leading byte of 172.16.0.0/12 private block |
C0 A8 | 192 168 | Home and office LANs, 192.168.0.0/16 |
FF | 255 | Subnet mask bytes, broadcast addresses |
Why 0100007F means 127.0.0.1
Linux lists open sockets in /proc/net/tcp and /proc/net/udp. Each address is a raw 32-bit number printed in host byte order. On x86 and ARM, host order is little-endian, so the four bytes come out reversed:
sl local_address rem_address st
0: 0100007F:1F90 00000000:0000 0A
1: 0A01A8C0:0016 6401A8C0:D2F4 01
Line 0 is 127.0.0.1 listening on port 8080. Line 1 is an SSH session from 192.168.1.100 to 192.168.1.10. The port after the colon stays in normal order, since the kernel prints the port as a plain number. Set Byte order to Little-endian, paste both lines, and the table lists address and port for each.
Where hex addresses turn up
| Source | Looks like | Byte order |
|---|---|---|
Wireshark bytes pane, tcpdump -X | c0 a8 01 0a | Network |
/proc/net/tcp, /proc/net/udp on x86 or ARM | 0A01A8C0:0050 | Little-endian |
/proc/net/tcp6 on x86 or ARM | 32 digits as four 8-digit words | Little-endian per word |
/proc/net/if_inet6 | fe800000000000000000000000000001 | Network |
| PXELINUX config file names | pxelinux.cfg/C0A8010A | Network |
C code printing s_addr with %08X on x86 | 0A01A8C0 | Little-endian |
Python hex(int(ipaddress.ip_address(...))) | 0xc0a8010a | Network |
Little-endian mode on a 32-digit IPv6 value reverses bytes inside each 8-digit word, which matches how /proc/net/tcp6 prints addresses. The words themselves keep their position.
IPv6: 32 digits in, short form out
IPv6 output follows RFC 5952. Letters go lowercase, leading zeros inside each group drop, and the longest run of two or more zero groups collapses to ::. So 20010DB8000000000000000000000001 prints as 2001:db8::1.
When the first 80 bits are zero and the next 16 are ffff, the result prints as an IPv4-mapped address such as ::ffff:192.168.1.10. Dual-stack servers write client addresses this way in access logs, so the embedded IPv4 address is the one to look up.
Limits worth knowing
- 8 or 32 digits only. Shorter IPv4 values get zeros on the left, so 0xA000001 reads as 10.0.0.1. A 12-digit MAC address or a 16-digit value gets rejected.
- No prefix lengths. A trailing /24 fails. Work out network and broadcast addresses in a subnet calculator after you decode the address.
- No Class A, B, or C label. Classful addressing ended with CIDR in 1993. The result names the registered range instead: private, loopback, carrier NAT, documentation, multicast, or public.
- Already-formatted IPv6 with :: gets refused. Shortened text is not raw hex. Paste the full 32-digit value.
- No lookups. The page decodes numbers. For the host behind an address, use IP to Hostname.