Base-2 (Binary) Number System

The fundamental language of computers - understanding binary as the foundation of all digital systems and cybersecurity applications.

Learning Objectives

  • Understand binary as the fundamental computer number system
  • Learn binary place values and conversion methods
  • Explore binary arithmetic and bitwise operations
  • Apply binary concepts to cybersecurity scenarios

Binary Fundamentals

What is Binary?

Binary uses only two digits: 0 and 1

These represent electronic switch states:

0
OFF (No current)
1
ON (Current flowing)

Binary Units

UnitValueDescription
Bit1 binary digitSmallest unit (0 or 1)
Byte8 bitsCan represent 256 different values (0-255)

Binary Place Values

Each position represents a power of 2. Here's an example with 11010110₂:

2⁷2⁶2⁵2⁴2⁰
1286432168421
11010110

Calculation: 11010110₂ = 128 + 64 + 16 + 4 + 2 = 214₁₀

Number System Conversions

Common Number Systems
  • Binary (Base 2): 0, 1
  • Octal (Base 8): 0-7
  • Decimal (Base 10): 0-9
  • Hexadecimal (Base 16): 0-9, A-F
Powers of 2 (Networking)
  • 21 = 2
  • 22 = 4
  • 23 = 8
  • 24 = 16
  • 28 = 256

Base Conversion Reference

DecimalBinaryOctalHexadecimal
0000000
1000111
2001022
3001133
4010044
5010155
6011066
7011177
81000108
91001119
10101012A
11101113B
12110014C
13110115D
14111016E
15111117F
25511111111377FF

Binary to Decimal

Method 1: Place Value Addition

Example: Convert 1011₂ to decimal

StepCalculation
11011₂ = (1×2³) + (0×2²) + (1×2¹) + (1×2⁰)
2= (1×8) + (0×4) + (1×2) + (1×1)
3= 8 + 0 + 2 + 1 = 11₁₀
Method 2: Doubling Method

Example: Convert 1011₂ to decimal

  1. Start with leftmost bit: 1
  2. Double and add next: (1×2) + 0 = 2
  3. Double and add next: (2×2) + 1 = 5
  4. Double and add next: (5×2) + 1 = 11

Decimal to Binary

Division by 2 Method

Example: Convert 13₁₀ to binary

DivisionQuotientRemainder
13 ÷ 261
6 ÷ 230
3 ÷ 211
1 ÷ 201
Read remainders upward: 1101₂

Binary Addition Rules

ABSumCarry
0000
0110
1010
1101

Note: When both bits are 1, the result is 0 with a carry of 1 to the next position.

Bitwise Operations

AND Operation (&)
1010
1100 &
1000

Result is 1 only when both bits are 1

OR Operation (|)
1010
1100 |
1110

Result is 1 when either bit is 1

Cybersecurity Applications

IP Address Representation

IPv4 addresses are 32-bit binary numbers divided into 4 octets:

DecimalBinary
19211000000
16810101000
100000001
100000001

192.168.1.1 = 11000000.10101000.00000001.00000001

File Permissions

Unix file permissions use 3-bit binary groups:

OctalBinaryPermissions
7111rwx (full access)
6110rw- (read/write)
4100r-- (read only)
0000--- (no access)
Network Subnetting

Subnet masks use binary to define network boundaries:

/24 Network:

255.255.255.0
11111111.11111111.11111111.00000000

/16 Network:

255.255.0.0
11111111.11111111.00000000.00000000

1s = Network portion
0s = Host portion

Binary Converter

Enter any decimal number to see its binary representation.

Quick Reference

Base:2
Digits:0, 1
Place Values:Powers of 2 (1, 2, 4, 8, 16...)
8 bits:1 byte (256 possible values)
Common Usage:Computer systems, digital logic