Skip to main content

Subnetting

Binary Basics

  • Binary uses only two values: 0 or 1
  • Each bit represents a single binary value (0 or 1)

Bit and Byte

  • 1 bit = 0 or 1
  • 1 byte = 8 bits
  • 1 octet = 1 byte = 8 bits

In networking, we usually say octet instead of byte because an IPv4 address always uses 8-bit groupings.


IPv4 Addresses and Decimal vs Binary

An IPv4 address is: 192.168.1.165

  • 32 bits total
  • Written as 4 octets
  • Each octet = 8 bits
  • Each octet is shown in decimal (base 10), but computers work in binary (base 2)

To truly understand an IP address, we convert each decimal octet into binary.


Decimal to Binary Conversion (One Octet)

Each octet uses 8 binary place values:

1286432168421

You determine whether each value is used (1) or not used (0).

Rule:

  • Put 1 if you use that value
  • Put 0 if you don’t
  • The values you choose must add up to the decimal number

Convert Each Octet to Binary

1) Convert 192 to Binary

192 = 128 + 64

1286432168421
11000000

192 = 11000000


2) Convert 168 to Binary

168 = 128 + 32 + 8

1286432168421
10101000

168 = 10101000


3) Convert 1 to Binary

1 = 1

1286432168421
00000001

1 = 00000001


4) Convert 165 to Binary

165 = 128 + 32 + 4 + 1

1286432168421
10100101

165 = 10100101

Final Answer (Full IPv4 in Binary):

11000000.10101000.00000001.10100101
192.168.1.165

Key Notes

  • Each octet is 8 bits, so it has 256 possible values
  • That’s why each octet ranges from:
    • 0 to 255 (because 2^8 = 256 values)

Host BitsTotal AddressesUsable Devices
120
242