2.3 Octal & Hexadecimal Systems

Octal Number System (Base-8)

The octal number system is a base-8 number system that uses digits from 0 to 7. It's particularly useful in computing because it can represent binary numbers in a more compact form.

Key Points

  • Base: 8
  • Digits: 0, 1, 2, 3, 4, 5, 6, 7
  • Each octal digit represents exactly 3 binary digits (bits)

Octal to Binary Conversion

Each octal digit can be directly converted to a 3-bit binary number:

Octal Binary
0 000
1 001
2 010
3 011
4 100
5 101
6 110
7 111

Hexadecimal Number System (Base-16)

The hexadecimal (hex) number system is a base-16 number system that uses sixteen distinct symbols: 0-9 and A-F (where A=10, B=11, ..., F=15). It's widely used in computing as a more human-friendly representation of binary-coded values.

Key Points

  • Base: 16
  • Digits: 0-9, A-F (A=10, B=11, C=12, D=13, E=14, F=15)
  • Each hex digit represents exactly 4 binary digits (bits)
  • Commonly used in programming and debugging

Hexadecimal to Binary Conversion

Each hexadecimal digit can be directly converted to a 4-bit binary number:

Hex Binary Decimal
0 0000 0
1 0001 1
2 0010 2
... ... ...
9 1001 9
A 1010 10
B 1011 11
C 1100 12
D 1101 13
E 1110 14
F 1111 15

Applications in Computing

Memory Addressing

Memory addresses are often displayed in hexadecimal because:

  • They are more compact than binary
  • They align well with byte boundaries (2 hex digits = 1 byte)
  • Easier to read and remember than binary

Color Representation

In web development, colors are often specified using hexadecimal notation:

  • #RRGGBB format
  • Each pair represents Red, Green, and Blue components
  • Example: #FF0000 is pure red, #00FF00 is green, #0000FF is blue