An IPv4 address contains 32 bits

An IPv4 address is made up of 32 bits total. Those 32 bits are divided into four sections of 8 bits each, called octets. Each octet is displayed as a decimal number between 0 and 255, separated by periods — which is why you see IPv4 addresses written as four numbers like 192.168.1.1.

The 32-bit structure is the reason IPv4 has a hard limit on how many unique addresses can exist. With 32 bits, there are 2 to the 32nd power possible combinations, which equals 4,294,967,296 total addresses. That seemed like plenty when IPv4 was designed in the 1980s, but the internet has grown far beyond that number, which is one reason IPv6 (which uses 128 bits) was created.

Key Takeaways

  • IPv4 addresses use exactly 32 bits, divided into four 8-bit octets displayed as decimal numbers from 0 to 255.
  • Each bit in an IPv4 address is either a 0 or a 1 in binary, but you see them converted to decimal form in everyday use.
  • The 32-bit limit creates a maximum of about 4.3 billion unique IPv4 addresses, which is why IPv6 with 128 bits was developed.
  • Subnet masks also use 32 bits and follow the same octet structure, determining which portion of an address identifies the network versus the individual device.

How the 32 bits are organized

The 32 bits break down into four octets of 8 bits each. In binary, an octet looks like 11000000 or 00000001. When converted to decimal for human readability, those same octets become 192 and 1. This is why the address 192.168.1.1 is actually 11000000.10101000.00000001.00000001 in pure binary form.

Each of the 8 bits in an octet represents a power of 2, starting from the right. The rightmost bit is worth 1, the next is worth 2, then 4, 8, 16, 32, 64, and 128. Add up whichever bits are set to 1, and you get the decimal number for that octet. For example, 128 + 64 = 192, so the binary 11000000 becomes 192 in decimal.

You do not need to convert between binary and decimal yourself in most network situations — your router and operating system handle that automatically. But understanding that the conversion exists helps explain why certain numbers appear in network settings and why subnet masks work the way they do.

Subnet masks also use 32 bits

A subnet mask is another 32-bit number that works alongside your IPv4 address. It tells the network which bits belong to the network portion of the address and which bits identify the individual device. A common subnet mask is 255.255.255.0, which is 24 ones followed by 8 zeros in binary.

The ones in the subnet mask correspond to the network portion, and the zeros correspond to the host (device) portion. In the example above, the first three octets (255.255.255) identify the network, and the last octet (0) is available for individual devices. That is why you can have up to 254 devices on a 255.255.255.0 network — the last octet can be any number from 1 to 254.

Different subnet masks use different numbers of bits for the network and host portions. A mask of 255.255.0.0 uses 16 bits for the network and 16 for hosts. A mask of 255.255.255.128 uses 25 bits for the network and 7 for hosts. The total always adds up to 32.

Why 32 bits was chosen for IPv4

When IPv4 was standardized in 1981, 32 bits seemed like a reasonable size. It provided over 4 billion possible addresses, which was far more than anyone expected the internet to need. The designers chose a power of 2 (2 to the 32nd) because binary math is efficient in computer hardware, and dividing it into four 8-bit octets made the addresses easier for humans to read and remember than a single 32-digit binary string.

The four-octet decimal format also made IPv4 addresses portable across different systems and easier to write down or communicate verbally. You can tell someone "go to 10.0.0.1" much faster than "go to 00001010.00000000.00000000.00000001."

The difference between IPv4's 32 bits and IPv6's 128 bits

IPv6 uses 128 bits instead of 32, which creates 2 to the 128th power possible addresses — a number so large it is effectively unlimited for practical purposes. That is roughly 340 undecillion addresses, or enough to assign a unique address to every atom on Earth many times over.

IPv6 addresses are written in hexadecimal (base 16) rather than decimal, and they are divided into eight 16-bit sections separated by colons, like 2001:0db8:85a3:0000:0000:8a2e:0370:7334. The larger address space was necessary because IPv4 addresses ran out, and the switch to IPv6 has been gradual over the past two decades.

Most networks today still use IPv4 alongside IPv6. Your device may have both an IPv4 and an IPv6 address at the same time, allowing it to communicate on both networks. Understanding that IPv4 is limited to 32 bits helps explain why this dual-stack approach exists and why IPv6 adoption continues to grow.

How bits relate to network speed and performance

The number of bits in an IPv4 address does not directly affect network speed. The 32-bit size is about addressing — identifying which device is which — not about how fast data moves. Network speed depends on your connection type (fiber, cable, DSL), your router, and the devices on your network, not on the address format.

However, the number of bits in a subnet mask does affect how many devices can fit on a single network segment. A /24 subnet (255.255.255.0) gives you 8 bits for devices, so up to 254 usable addresses. A /16 subnet (255.255.0.0) gives you 16 bits for devices, so up to 65,534 usable addresses. Larger networks with more bits available for devices can theoretically handle more traffic, but the actual performance depends on your hardware and bandwidth, not the bit count alone.

Frequently Asked Questions

Why is it 32 bits and not 16 or 64?

IPv4 was designed in 1981 when 32 bits was a practical balance between address space and hardware efficiency. Sixteen bits would have provided only 65,536 addresses, which was already too small. Sixty-four bits would have been wasteful at the time. The designers chose 32 because it was a power of 2, worked well with computer architecture, and seemed to provide more addresses than the internet would ever need.

Can I use all 32 bits for device addresses?

No. In any network, some addresses are reserved. The network address (all host bits set to 0) and the broadcast address (all host bits set to 1) cannot be assigned to devices. On a 255.255.255.0 network, you have 8 bits for devices, but only 254 are usable — 192.168.1.0 is the network address and 192.168.1.255 is the broadcast address, leaving 192.168.1.1 through 192.168.1.254 for actual devices.

Does IPv4 address length affect security?

The 32-bit length itself does not determine security. Security depends on how the address is used, what firewall rules are in place, and what protocols protect the data traveling to that address. IPv6's larger 128-bit address space does make certain types of address scanning harder simply because there are so many more possible addresses to scan, but this is a side effect, not the primary reason for the larger size.

What is CIDR notation and how does it relate to the 32 bits?

CIDR notation (Classless Inter-Domain Routing) is a shorthand for describing subnet masks using the 32-bit total. A /24 means the first 24 bits are the network portion, leaving 8 bits for devices. A /16 means 16 bits for the network and 16 for devices. The number after the slash always refers to how many of the 32 bits are used for the network portion.