An IPv4 address such as 192.168.0.1 is really a 32-bit number written for human eyes. To convert it to binary, take each of the four octets, turn it into an 8-bit binary number, and join the four with dots. So 192.168.0.1 becomes 11000000.10101000.00000000.00000001. The IP to binary converter does this for any address, and reads binary, integer or hex back into a dotted-quad. Here is the method, and why it matters.
Why an IP is binary underneath
The dotted decimal form is a convenience. Each octet is 8 bits, and four octets make 32 bits. Routers, switches and your own machine never see the dots. They see the raw bits and use them to decide which part of the address is the network and which is the host. That decision is a bitwise operation, so reading an address in binary is the only way to see exactly what the hardware does.
This is also why subnetting is taught in binary. The subnet mask lines up against the address bit for bit, and the boundary between network and host can fall anywhere in the 32 bits, not just on an octet edge.
Converting one octet
Each octet is a number from 0 to 255, which is exactly what 8 bits can hold. To convert it, use the place values of the eight bit positions:
128 64 32 16 8 4 2 1
Work from the left. If the value is 128 or more, put a 1 in that column and subtract 128. Move right and repeat for each place value. Take 192:
- 192 is at least 128, so write 1 and leave 64.
- 64 is at least 64, so write 1 and leave 0.
- The rest are 0.
That gives 11000000. Do the same for 168:
- 168 minus 128 is 40, so the 128 bit is 1.
- 40 is less than 64, so the 64 bit is 0.
- 40 minus 32 is 8, so the 32 bit is 1, the 16 bit is 0.
- 8 minus 8 is 0, so the 8 bit is 1, and the rest are 0.
That gives 10101000. Joining the four octets of 192.168.0.1:
11000000.10101000.00000000.00000001
Converting back to decimal
Going the other way is the same place-value table in reverse. Split the 32 bits into four groups of 8, then add the place values of the bits that are set in each group. 11000000 is 128 plus 64, which is 192. 10101000 is 128 plus 32 plus 8, which is 168. Join with dots and you have the dotted-quad back.
A common practice exercise is to drop the dots entirely and read the full 32-bit string, which is what the converter accepts as input alongside the dotted form.
The same bits as an integer and hex
Because the address is just 32 bits, it has two other useful forms.
As a single unsigned integer, the four octets are the four bytes of a number from 0 to 4,294,967,295. You build it by shifting each octet into place: the first octet times 16,777,216, plus the second times 65,536, plus the third times 256, plus the fourth. For 192.168.0.1 that is 3,232,235,521. Storing an address as one integer makes range checks fast, because you can compare addresses as plain numbers.
As hex, each octet becomes two hex digits, since one hex digit covers 4 bits. 192 is C0, 168 is A8, so 192.168.0.1 is 0xC0A80001. Hex shows up in packet captures and low-level config, where a compact form is handy.
| Form | 192.168.0.1 |
|---|---|
| Binary | 11000000.10101000.00000000.00000001 |
| Decimal integer | 3232235521 |
| Hex | 0xC0A80001 |
Checking your work
The bit method is worth learning, because it is what exams test and what the hardware actually does. For day-to-day work, or to check an answer, enter the address into the IP to binary converter. It shows the dotted binary, the integer and the hex together, with a per-octet table, and it reads any of those forms back into a dotted-quad. Once you are comfortable with the bits, the subnet mask guide shows how the same binary view drives the network and host split, and the CIDR guide covers how the prefix length sits on top of it.