Internet Protocol Version 4 (IPv4) — Part 1
Every packet on the Internet carries a 32-bit IPv4 address. This lesson takes that address apart: the four octets, the dotted-decimal notation, and the binary arithmetic you must be able to do on paper without a calculator.
Why do we need addresses?
A network moves data between hosts. For a message to arrive at the correct destination, and for the reply to come back, every host needs a unique way to be identified on its network. IPv4 provides that identity as a logical address — logical because it is assigned by software or an administrator and can change, unlike the permanent MAC address burned into the network card.
IP addressing lives at the Network layer (Layer 3) of the OSI model. A router reads the IPv4 address to decide where to forward a packet, and this is exactly what lets a packet cross from one network to another, all the way across the Internet. The rules that define the format are specified in RFC 791, the original 1981 standard for the Internet Protocol.
192.168.10.42, and identifies the host within the Layer 3 network.The 32-bit address and dotted-decimal notation
An IPv4 address is exactly 32 bits long. A bit is one binary digit, either 0 or 1. Thirty-two bits give a theoretical address space of 232 = 4,294,967,296 unique addresses. That sounds huge, but it is the very shortage of these addresses that drove the design of private addressing (Lesson 5) and, later, IPv6.
The 32 bits are divided into four equal groups of 8 bits. Each group is called an octet (from “octo”, eight). Because 8 bits can represent 28 = 256 different values, each octet ranges from 0 to 255. That is the single most important range fact in IPv4.
256 or 300, it is invalid — a classic distractor.Writing 32 ones and zeros every time would be unreadable, so IPv4 uses dotted-decimal notation: each 8-bit octet is converted to its decimal value, and the four decimal numbers are separated by dots. The address 11000000.10101000.00001010.00101010 in binary becomes 192.168.10.42 in dotted-decimal. Both forms describe the same address; they are just two encodings of the same 32 bits.
Octets and place values
Inside an octet, every bit position has a fixed place value, doubling from right to left, exactly like the decimal hundreds/tens/units idea but in base 2. The eight place values are:
Bit position: 1 2 3 4 5 6 7 8 Place value: 128 64 32 16 8 4 2 1
To read an octet, add up the place values wherever a 1 appears; ignore the positions holding a 0. If every bit is 1 the sum is 128+64+32+16+8+4+2+1 = 255; if every bit is 0 the value is 0. That is why an octet can never exceed 255.
Binary and decimal conversion
You must be able to convert an octet both ways by hand. Both directions use the same eight place values.
Binary → decimal
Convert 11000000 to decimal. Write the place values above the bits and add the ones that are set:
Place value: 128 64 32 16 8 4 2 1 Binary bit: 1 1 0 0 0 0 0 0 Included: 128+ 64 = 192 Result: 11000000 = 192
Now convert 00101010:
Place value: 128 64 32 16 8 4 2 1 Binary bit: 0 0 1 0 1 0 1 0 Included: 32 + 8 + 2 = 42 Result: 00101010 = 42
Only the positions marked with a 1 are added. 00101010 has ones at the 32, 8 and 2 positions, giving 32 + 8 + 2 = 42. Always confirm your answer is between 0 and 255.
Decimal → binary
Going the other way, subtract the largest place value that still fits, then repeat with the remainder. Convert 173:
Place values: 128 64 32 16 8 4 2 1 173 - 128 = 45 -> 128 bit = 1 45 - 32 = 13 -> 64 bit = 0, 32 bit = 1 13 - 8 = 5 -> 16 bit = 0, 8 bit = 1 5 - 4 = 1 -> 4 bit = 1 1 - 1 = 0 -> 2 bit = 0, 1 bit = 1 Binary: 10101101 Check: 128 + 32 + 8 + 4 + 1 = 173 (correct)
1 and subtract it; if it does not fit, write 0 and move on. When you reach the end the remainder must be 0.A conversion table
Learn the patterns rather than memorising every value. The table below shows the octets you will meet most often, with the arithmetic spelled out:
| Decimal | Binary | Working (set place values) |
|---|---|---|
| 0 | 00000000 | none |
| 1 | 00000001 | 1 |
| 10 | 00001010 | 8 + 2 |
| 42 | 00101010 | 32 + 8 + 2 |
| 168 | 10101000 | 128 + 32 + 8 |
| 192 | 11000000 | 128 + 64 |
| 224 | 11100000 | 128 + 64 + 32 |
| 240 | 11110000 | 128 + 64 + 32 + 16 |
| 254 | 11111110 | 128 + 64 + 32 + 16 + 8 + 4 + 2 |
| 255 | 11111111 | 128 + 64 + 32 + 16 + 8 + 4 + 2 + 1 |
11000000). Some programming contexts prefix a binary literal with 0b, so 0b11000000 is the same value 192. The 0b prefix is just a label meaning “this is binary”.Reading a full address
Put it together for 192.168.10.42. Set each octet below and watch the table convert the whole address, octet by octet.
The full 32-bit binary form of 192.168.10.42 is 11000000.10101000.00001010.00101010. Notice how the dots fall every eight bits, which is why the decimal dots and the binary dots line up. This skill — converting an address both ways — is the mechanical foundation for everything that follows: masks, subnets, and the AND operation in Lesson 7.
Review
Check what you have learned with these review questions.
Sources & references
- Postel, J. RFC 791: Internet Protocol (1981). The IPv4 address format. rfc-editor.org/rfc/rfc791.
- Braden, R. RFC 1122: Requirements for Internet Hosts — Communication Layers (1989). rfc-editor.org/rfc/rfc1122.
- Rekhter, Y. et al. RFC 1918: Address Allocation for Private Internets (1996). rfc-editor.org/rfc/rfc1918.
- Arkko, J., Cotton, M. & Vegoda, L. RFC 5737: IPv4 Address Blocks Reserved for Documentation (2010). rfc-editor.org/rfc/rfc5737.
- Cotton, M. & Vegoda, L. RFC 5735: Special Use IPv4 Addresses (2010). rfc-editor.org/rfc/rfc5735.
- Cheshire, S., Aboba, B. & Guttman, E. RFC 3927: Dynamic Configuration of IPv4 Link-Local Addresses (2005). rfc-editor.org/rfc/rfc3927.
- Weil, J. et al. RFC 6598: IANA-Reserved IPv4 Prefix for Shared Address Space (2012). rfc-editor.org/rfc/rfc6598.
- IANA. IPv4 Special-Purpose Address Registry. iana.org.
- Cisco. CCNA (200-301) Exam Topics, Network Fundamentals (IP addressing). cisco.com.
Target exams: CCNA 200-301 v1.1 · CyberOps Associate 200-201. Last content verification: 2026-10-11.