Base-16 (Hexadecimal) Number System

The bridge between human-readable and machine code - essential for memory addressing, networking, and cybersecurity applications.

Learning Objectives

  • Understand hexadecimal as a base-16 number system
  • Learn conversion between hex, decimal, and binary
  • Master various hexadecimal notation styles
  • Apply hex concepts to real-world technology scenarios

Hexadecimal Fundamentals

What is Hexadecimal?

Hexadecimal uses 16 distinct symbols:

Digits (0-9)
0 1 2 3 4 5 6 7 8 9
Letters (A-F)
A B C D E F

๐Ÿ’ก One hex digit represents exactly 4 bits (a nibble)

Hexadecimal Values

Hex Decimal Binary
0 0 0000
A 10 1010
F 15 1111

Notation Styles

Programming
0x2A
C, Java, Python
Web Colors
#FF0000
HTML, CSS
Assembly
2Ah
Assembly language
Mathematical
2Aโ‚โ‚†
Mathematical notation

Conversion Methods

Hex to Decimal

Positional Value Method

Example: Convert 2A3โ‚โ‚† to decimal

2
16ยฒ = 256
2 ร— 256 = 512
A
16ยน = 16
10 ร— 16 = 160
3
16โฐ = 1
3 ร— 1 = 3
2A3โ‚โ‚† = 512 + 160 + 3 = 675โ‚โ‚€

Decimal to Hex

Repeated Division by 16

Example: Convert 255โ‚โ‚€ to hexadecimal

255 รท 16 = 15 remainder F
15 รท 16 = 0 remainder F
Read remainders upward: FFโ‚โ‚†

Binary to Hex

Group by 4 Method

Example: Convert 11010110โ‚‚ to hex

11010110โ‚‚
1101 | 0110
D | 6
Result: D6โ‚โ‚†

Practical Applications

Memory Addressing

Computer memory addresses are commonly displayed in hexadecimal:

0x7FFF0000
32-bit memory address

Each pair of hex digits represents one byte of data.

Network MAC Addresses

MAC addresses use 6 bytes (12 hex digits) separated by colons:

00:1A:2B:3C:4D:5E
00:1A:2B Manufacturer ID 3C:4D:5E Device ID

Web Color Codes

RGB colors use 3 bytes (6 hex digits) for red, green, and blue:

#FF0000
FF = 255 Red
00 = 0 Green
00 = 0 Blue
#00FF00
00 = 0 Red
FF = 255 Green
00 = 0 Blue

Cryptographic Hashes

Hash values are typically displayed in hexadecimal:

MD5 Hash:
5d41402abc4b2a76b9719d911017c592
SHA-256 Hash:
2cf24dba4f21d4288094c3b8e9ba6c3a57b2d6ec9b8c0b8d7f4e4e6e7f8f9fa

Hands-On Exercises

Exercise 1: Hex to Decimal

Convert these hex values to decimal:

A7โ‚โ‚† = ?

Solution:

A7โ‚โ‚† = (Aร—16ยน) + (7ร—16โฐ)

= (10ร—16) + (7ร—1)

= 160 + 7 = 167โ‚โ‚€

Exercise 2: Decimal to Hex

Convert these decimal values to hex:

200โ‚โ‚€ = ?

Solution:

200 รท 16 = 12 remainder 8

12 รท 16 = 0 remainder C

200โ‚โ‚€ = C8โ‚โ‚†

Exercise 3: Binary to Hex

Convert these binary values to hex:

10110011โ‚‚ = ?

Solution:

10110011โ‚‚

Group by 4: 1011 | 0011

Convert: B | 3

10110011โ‚‚ = B3โ‚โ‚†

Exercise 4: Message Decoding

Decode this hex message (ASCII):

48656C6C6F = ?

Solution:

48โ‚โ‚† = 72โ‚โ‚€ = 'H'

65โ‚โ‚† = 101โ‚โ‚€ = 'e'

6Cโ‚โ‚† = 108โ‚โ‚€ = 'l'

6Cโ‚โ‚† = 108โ‚โ‚€ = 'l'

6Fโ‚โ‚† = 111โ‚โ‚€ = 'o'

Message: "Hello"