IP to hex: IPv4 addresses in base 16
An IPv4 address is a single 32-bit number, and converting IP to hex simply writes that number in base 16. Because every octet is one byte, each octet becomes exactly two hex digits, so any address fits in eight digits. This converter prints both the combined value and the byte-by-byte form, for example 192.168.1.1 → 0xC0A80101 (C0.A8.01.01).
How the conversion works
Convert each octet on its own, pad it to two digits, then join the four pairs in their original order:
| Octet | Decimal | Math | Hex |
|---|---|---|---|
| 1st | 192 | 12 × 16 + 0 | C0 |
| 2nd | 168 | 10 × 16 + 8 | A8 |
| 3rd | 1 | 0 × 16 + 1 | 01 |
| 4th | 1 | 0 × 16 + 1 | 01 |
The padding is not cosmetic. 10.0.0.254 is 0x0A0000FE; if you drop the leading zero of each byte you get A00FE, which is a completely different number.
192.168.1.1 → 0xC0A80101 (C0.A8.01.01)
10.0.0.254 → 0x0A0000FE (0A.00.00.FE)
8.8.8.8 → 0x08080808 (08.08.08.08)
172.16.254.1 → 0xAC10FE01 (AC.10.FE.01)
Where hexadecimal IP addresses appear
- Packet dumps. The source and destination fields of an IPv4 header are four raw bytes, so a hex dump of a packet sent to 8.8.8.8 contains
08 08 08 08. - PXE network boot. PXELINUX searches for a configuration file named after the client address in uppercase hex, so a machine at 192.168.1.1 asks for
C0A80101. - Kernel tables. Linux files such as
/proc/net/routelist addresses as eight hex digits. - Debuggers. A
struct in_addrholds the address as a 32-bit integer, which a debugger often prints in hex.
Byte order: the most common surprise
This converter writes the bytes in network byte order (big-endian): the first octet is the most significant byte, exactly as the address travels on the wire. Many tools print the same four bytes in the host order of an x86 CPU, which is little-endian. In /proc/net/route, the network 192.168.1.0 shows up as 0001A8C0, the reverse of C0A80100.
If a value from a log does not match what you expect, swap the byte order with the Reverse Hex tool and compare again. To go the other way, paste the hex into Hex to IP; for the plain integer form, use IP to Decimal.
Validation and privacy
The address must contain exactly four decimal octets from 0 to 255. Inputs such as 256.1.1.1 or the shorthand 192.168.1 are marked as invalid, with an error that quotes the offending value. Hex digits are printed in uppercase, but hex is case-insensitive, so 0xc0a80101 means the same thing. The conversion runs entirely in your browser; the addresses you enter are not sent to our server.