🔢 IP to Binary/Hex Converter
Enter an IPv4 address to see its binary (per-octet and full 32-bit), hexadecimal and decimal integer forms.
One number, four notations
Each octet is converted on its own to base 2 and base 16 and padded to a fixed width, then the whole address is rebuilt as a single 32-bit value by weighting the octets:
binary = each octet in base 2, padded to 8 digits
hex = each octet in base 16, padded to 2 digits
decimal = o1x16777216 + o2x65536 + o3x256 + o4
The default 192.168.1.1 comes back as 11000000.10101000.00000001.00000001, C0.A8.01.01 and 3,232,235,777. Those weights are just 2^24, 2^16 and 2^8 - the same as shifting each octet into place, but done with multiplication so the top octet cannot tip a signed 32-bit value negative, which is the usual way this conversion goes wrong in code.
Where each form gets used
- Binary is how you see a prefix boundary. A /26 keeps the first 26 of these digits, so in 192.168.1.1 the cut falls two bits into the last octet: 00 is network and the remaining 000001 is the host part, which is why the address sits in 192.168.1.0/26 rather than a block starting at .64.
- Hex shows up in packet captures, in URLs written to dodge naive filters, and in IPv6 mapped addresses, where 192.168.1.1 is written ::ffff:c0a8:101.
- The 32-bit integer is how databases store addresses so they can be compared and range-scanned. MySQL's INET_ATON returns exactly the 3,232,235,777 shown here.
Frequently asked questions
What is 192.168.1.1 in binary?
11000000.10101000.00000001.00000001. Each octet becomes eight digits, padded with leading zeros so the 32 bits always line up in columns.
What is 192.168.1.1 as a decimal number?
3,232,235,777. Multiply the octets by 16,777,216, 65,536, 256 and 1 and add them: 3,221,225,472 + 11,010,048 + 256 + 1.
How do I convert an IP address to hexadecimal?
Convert each octet separately and pad it to two digits. 192 is C0, 168 is A8, and 1 is 01, giving C0A80101 for the whole address.