Hexadecimal Number System Conversion
Hexadecimal Number System Conversion – Complete Guide
Introduction to the Hexadecimal Number System
The hexadecimal number system is a base-16 system that uses 16 symbols:
Here,
A = 10, B = 11, C = 12, D = 13, E = 14, F = 15 (in decimal).
It is widely used in digital electronics, computer programming, memory addressing, and color codes in web design because it provides a compact way to represent binary numbers.
Types of Hexadecimal Number Conversions
Hexadecimal numbers are often converted to and from other number systems:
-
Hexadecimal to Decimal
-
Decimal to Hexadecimal
-
Hexadecimal to Binary
-
Binary to Hexadecimal
-
Hexadecimal to Octal (via binary as an intermediate step)
1. Hexadecimal to Decimal Conversion
To convert from hexadecimal to decimal:
-
Multiply each digit by 16 raised to the power of its position (starting from 0 at the rightmost digit).
-
Add the results.
Example: Convert 2F to decimal
= (2 × 16¹) + (F × 16⁰)
= (2 × 16) + (15 × 1)
= 32 + 15
= 47
2. Decimal to Hexadecimal Conversion
To convert from decimal to hexadecimal:
For Integer Part:
-
Divide the decimal number by 16.
-
Write the remainder (convert 10–15 into A–F).
-
Repeat until quotient is 0.
-
Read remainders from bottom to top.
For Fractional Part:
-
Multiply the fraction by 16.
-
Take the integer part as the hexadecimal digit.
-
Repeat until fraction becomes 0 or desired precision is reached.
Example: Convert 255 to hexadecimal
255 ÷ 16 = 15 R15 (F)
15 ÷ 16 = 0 R15 (F)
Result: FF
3. Hexadecimal to Binary Conversion
Each hexadecimal digit can be replaced by its 4-bit binary equivalent:
| Hex | Binary |
|---|---|
| 0 | 0000 |
| 1 | 0001 |
| 2 | 0010 |
| 3 | 0011 |
| 4 | 0100 |
| 5 | 0101 |
| 6 | 0110 |
| 7 | 0111 |
| 8 | 1000 |
| 9 | 1001 |
| A | 1010 |
| B | 1011 |
| C | 1100 |
| D | 1101 |
| E | 1110 |
| F | 1111 |
Example: Convert 3A to binary
3 → 0011, A → 1010 → 00111010
4. Binary to Hexadecimal Conversion
Group the binary number into 4-bit groups starting from the right and replace each group with its hexadecimal equivalent.
Example: Convert 11010110 to hexadecimal
Group: 1101 0110
1101 → D, 0110 → 6
Result: D6
5. Hexadecimal to Octal Conversion
-
Convert hexadecimal to binary (each digit → 4 bits).
-
Group binary into 3 bits from right to left.
-
Convert each group to octal.
Example: Convert 2F to octal
Hex 2 → 0010, F → 1111 → Binary: 00101111
Group in 3 bits: 00 101 111 → Octal: 57
Quick Conversion Table
| Decimal | Hex | Binary | Octal |
|---|---|---|---|
| 0 | 0 | 0000 | 0 |
| 1 | 1 | 0001 | 1 |
| 10 | A | 1010 | 12 |
| 15 | F | 1111 | 17 |
| 16 | 10 | 10000 | 20 |
| 31 | 1F | 11111 | 37 |
| 47 | 2F | 101111 | 57 |
| 255 | FF | 11111111 | 377 |
Applications of Hexadecimal Conversion
-
Computer Memory Addressing – Compact representation of large binary addresses.
-
Programming – Often used in assembly language, debugging, and machine code.
-
Web Design – Color codes (e.g., #FF5733 in HTML/CSS).
-
Networking – MAC addresses and IPv6 addresses are written in hexadecimal.

Comments
Post a Comment