How IPv4 Converts to a 32-Bit Binary Sequence
An Internet Protocol version 4 (IPv4) address is fundamentally a 32-bit unsigned integer represented in a human-readable format known as dotted-decimal notation. While users and network administrators interact with four decimal numbers separated by periods, networking hardware processes this identifier as an uninterrupted sequence of 32 binary digits (bits). This article explains how dotted-decimal IPv4 addresses decompose into individual 8-bit octets and map directly to a continuous 32-bit linear address governed by the base-2 binary number system.
Structure of Dotted-Decimal Notation
An IPv4 address consists of four decimal integers separated by dots
(for example, 192.168.1.1). Each of these four numbers
represents an octet, which is a group of 8 bits.
Because an octet contains 8 bits, each position in the dotted-decimal
format can represent \(2^8\) (or 256)
possible values, ranging from 0 to 255. The
four octets combined total 32 bits (\(4 \times
8 = 32\)), providing a theoretical address space of \(2^{32}\), or 4,294,967,296 unique
addresses.
Decimal-to-Binary Octet Conversion
To convert an IPv4 address into its underlying binary form, each decimal octet is independently converted into an 8-bit binary number using positional base-2 notation.
Each bit within an 8-bit octet corresponds to a power of 2, starting from \(2^7\) on the far left down to \(2^0\) on the far right:
| Bit Position | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
|---|---|---|---|---|---|---|---|---|
| Decimal Value (\(2^n\)) | 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
To convert a decimal value into binary, determine which combination of these place values sums to the target number:
- 192: \(128 + 64 = 11000000_2\)
- 168: \(128 + 32 + 8 = 10101000_2\)
- 1: \(1 = 00000001_2\)
- 1: \(1 = 00000001_2\)
Leading zeros are preserved so that each segment always contains exactly 8 bits.
Assembling the 32-Bit Linear Sequence
Once each octet is converted into an 8-bit binary pattern, the human-readable delimiters (dots) are removed. The four 8-bit segments concatenate to form a continuous, linear 32-bit sequence:
- Dotted-Decimal:
192.168.1.1 - Dotted-Binary:
11000000.10101000.00000001.00000001 - 32-Bit Linear Sequence:
11000000101010000000000100000001
Mathematical Representation as a Single Integer
The linear sequence can also be calculated directly as a single 32-bit unsigned integer. By shifting each octet into its respective binary position, the full integer value is calculated using the formula:
\[\text{Address} = (A \times 256^3) + (B \times 256^2) + (C \times 256^1) + (D \times 256^0)\]
Where \(A.B.C.D\) represents the four octets:
\[\text{Address} = (192 \times 16,777,216) + (168 \times 65,536) + (1 \times 256) + (1 \times 1)\] \[\text{Address} = 3,221,225,472 + 11,010,048 + 256 + 1 = 3,232,235,777\]
The decimal integer 3232235777 is mathematically
identical to the binary sequence
11000000101010000000000100000001 and the address
192.168.1.1.
Network Significance
Routers and network interfaces operate directly on this 32-bit
sequence. Subnet masks and CIDR prefixes (such as /24)
specify how many bits from the left represent the network
prefix and how many remaining bits on the right represent the
host identifier. By performing bitwise logical
operations (such as AND) on the 32-bit linear sequence,
network hardware determines routing paths and packet destinations with
computational efficiency.