👁 Preview — Study, Practice and Revise are open; mock tests and the rest of the syllabus unlock on subscription. Unlock all · ₹4,999
← Back to Number Systems & Logic
Study mode

Hexadecimal

Introduction to Hexadecimal Number System

In the world of computers and digital electronics, numbers are often represented in different systems to make processing and understanding easier. One such important system is the hexadecimal number system, often called simply "hex".

The hexadecimal system is a base-16 number system. This means it uses 16 unique symbols to represent values. Unlike the decimal system (base-10), which uses digits 0 through 9, hexadecimal uses digits 0 to 9 and then the letters A to F to represent values from 10 to 15.

Why is hexadecimal important? Because it provides a compact and human-friendly way to represent binary numbers (base-2), which computers use internally. Hexadecimal numbers are shorter and easier to read than long strings of binary digits, making them very useful in programming, memory addressing, and digital color codes.

Hexadecimal Number System

Let's understand the basics of the hexadecimal system:

  • Base-16: Each digit in a hex number represents a power of 16, starting from the rightmost digit which is the 160 place.
  • Digits: The digits range from 0 to 9, then A, B, C, D, E, F representing decimal values 10 to 15 respectively.
  • Place Values: Just like decimal numbers, the value of a hex number depends on the position of each digit.
Hexadecimal Digits and Their Decimal Equivalents
Hex Digit Decimal Value
00
11
22
33
44
55
66
77
88
99
A10
B11
C12
D13
E14
F15

For example, the hex number 1F means:

\(1 \times 16^1 + 15 \times 16^0 = 16 + 15 = 31\) in decimal.

Conversion Between Hexadecimal and Decimal

Understanding how to convert between hexadecimal and decimal is crucial. Let's look at both directions.

graph TD    A[Start] --> B{Convert Hex to Decimal?}    B -- Yes --> C[Identify each hex digit and its decimal value]    C --> D[Multiply each digit by 16 raised to its position power]    D --> E[Sum all the values]    E --> F[Decimal number obtained]    B -- No --> G{Convert Decimal to Hex?}    G -- Yes --> H[Divide decimal number by 16]    H --> I[Record remainder as hex digit]    I --> J[Divide quotient by 16 again]    J --> K{Quotient zero?}    K -- No --> I    K -- Yes --> L[Write remainders in reverse order]    L --> M[Hexadecimal number obtained]

Hexadecimal to Decimal: Multiply each hex digit by \(16^i\) where \(i\) is the position index from right (starting at 0), then add all results.

Decimal to Hexadecimal: Divide the decimal number repeatedly by 16, noting the remainder each time. The hex number is the remainders read from last to first.

Conversion Between Hexadecimal and Binary

Because 16 is a power of 2 (specifically \(16 = 2^4\)), each hex digit corresponds exactly to 4 binary bits. This makes conversion between hex and binary straightforward and fast.

Hexadecimal to 4-bit Binary Mapping
Hex Digit Binary Equivalent (4 bits)
00000
10001
20010
30011
40100
50101
60110
70111
81000
91001
A1010
B1011
C1100
D1101
E1110
F1111

To convert a hex number to binary, replace each hex digit with its 4-bit binary equivalent. To convert binary to hex, group binary digits in sets of 4 (starting from the right), then convert each group to its hex digit.

Worked Examples

Example 1: Convert Hexadecimal 2F to Decimal Easy
Convert the hexadecimal number 2F to its decimal equivalent.

Step 1: Identify each digit and its decimal value.

2 = 2, F = 15

Step 2: Multiply each digit by 16 raised to its position (rightmost digit is position 0).

\(2 \times 16^1 = 2 \times 16 = 32\)

\(15 \times 16^0 = 15 \times 1 = 15\)

Step 3: Add the results.

\(32 + 15 = 47\)

Answer: Hexadecimal 2F equals decimal 47.

Example 2: Convert Decimal 255 to Hexadecimal Easy
Convert the decimal number 255 to its hexadecimal equivalent.

Step 1: Divide 255 by 16.

255 / 16 = 15 remainder 15

Step 2: Divide quotient 15 by 16.

15 / 16 = 0 remainder 15

Step 3: Write remainders in reverse order.

Remainders: 15 (F), 15 (F)

Answer: Decimal 255 equals hexadecimal FF.

Example 3: Convert Hexadecimal 1A3 to Binary Medium
Convert the hexadecimal number 1A3 to binary.

Step 1: Convert each hex digit to 4-bit binary using the table.

  • 1 = 0001
  • A = 1010
  • 3 = 0011

Step 2: Combine the binary groups.

0001 1010 0011

Answer: Hexadecimal 1A3 equals binary 000110100011.

Example 4: Add Hexadecimal Numbers 3B + 4F Medium
Add the hexadecimal numbers 3B and 4F.

Step 1: Convert hex digits to decimal for addition.

3B: 3 = 3, B = 11

4F: 4 = 4, F = 15

Step 2: Add the rightmost digits (units place): 11 + 15 = 26.

Since 26 > 15, subtract 16: 26 - 16 = 10 (which is A in hex), carry over 1 to next digit.

Step 3: Add left digits plus carry: 3 + 4 + 1 = 8.

Step 4: Combine results: left digit 8, right digit A.

Answer: 3B + 4F = 8A in hexadecimal.

Example 5: Subtract Hexadecimal Numbers 7E - 2A Medium
Subtract 2A from 7E in hexadecimal.

Step 1: Convert digits to decimal.

7E: 7 = 7, E = 14

2A: 2 = 2, A = 10

Step 2: Subtract rightmost digits: 14 - 10 = 4.

Step 3: Subtract left digits: 7 - 2 = 5.

Step 4: Combine results: 5 (left), 4 (right).

Answer: 7E - 2A = 54 in hexadecimal.

Formula Bank

Hexadecimal to Decimal Conversion
\[ D = \sum_{i=0}^{n-1} d_i \times 16^i \]
where: \(D\) = decimal number, \(d_i\) = hex digit value at position \(i\), \(n\) = number of digits
Decimal to Hexadecimal Conversion
\[ \text{Repeated division by 16; remainders form hex digits} \]
where: Decimal number (input), remainders (hex digits)
Hexadecimal to Binary Conversion
\[ \text{Each hex digit } d \text{ corresponds to 4-bit binary } b_3 b_2 b_1 b_0 \]
where: \(d\) = hex digit, \(b_3 b_2 b_1 b_0\) = binary bits

Tips & Tricks

Tip: Memorize hex digits 0-9 and letters A-F with their decimal equivalents.

When to use: When converting between hex and decimal or performing arithmetic.

Tip: Use 4-bit binary groups to convert hex to binary quickly.

When to use: For fast conversion between hex and binary without lengthy calculations.

Tip: Remember that each hex digit represents exactly 4 binary bits.

When to use: To simplify conversions and understand data representation in computers.

Tip: For decimal to hex, keep dividing by 16 and note remainders carefully.

When to use: When converting decimal numbers to hexadecimal.

Tip: Use a hex addition table or convert to decimal if stuck during arithmetic.

When to use: When performing addition or subtraction in hexadecimal.

Common Mistakes to Avoid

❌ Confusing hex digits A-F with decimal numbers
✓ Always remember A=10, B=11, ..., F=15 in decimal
Why: Students often treat letters as separate from numbers, causing errors in conversion and arithmetic.
❌ Incorrectly grouping binary digits when converting to hex
✓ Group binary digits in sets of 4 starting from the right; add leading zeros if needed
Why: Misalignment leads to wrong hex digits.
❌ Forgetting to carry or borrow properly in hex addition/subtraction
✓ Apply carry/borrow rules similar to decimal but base 16
Why: Lack of practice with base-16 arithmetic causes errors.
❌ Mixing up the order of remainders when converting decimal to hex
✓ Write remainders in reverse order of calculation
Why: Students often write remainders in the order obtained, leading to wrong hex number.
❌ Using decimal addition rules directly on hex digits without conversion
✓ Convert hex digits to decimal or use hex addition rules
Why: Hex arithmetic requires base-16 understanding, not base-10.
Key Concept

Hexadecimal Number System

Base-16 system using digits 0-9 and letters A-F representing values 0-15. Each digit represents a power of 16.

Key Concept

Conversions

Hex to decimal by place value expansion. Decimal to hex by repeated division by 16. Hex to binary by mapping each hex digit to 4 binary bits.

Key Concept

Hexadecimal Applications

Used in memory addressing, color codes in computing, MAC/IP addresses, and assembly language programming.

Key Takeaways

  • Hexadecimal is base-16, using digits 0-9 and A-F.
  • Each hex digit corresponds to 4 binary bits.
  • Conversions between hex, decimal, and binary are essential skills.
  • Hexadecimal simplifies representation of large binary numbers.
  • Practice arithmetic in hex carefully with carry and borrow rules.
Key Takeaway:

Mastering hexadecimal numbers is crucial for computer aptitude and digital electronics understanding.

Curated videos per subtopic
Top YouTube explainers, AI-ranked for your exam and language. Unlocks with subscription.
Unlock

Try Practice next.

Progress tracking is paywalled — subscribe to mark subtopics as understood and save your streak.

Go to practice →
Ask a doubt
Hexadecimal · 10 free messages
Ask me anything about this subtopic. You have 10 free messages this session — chat history isn't saved in preview.