Hexadecimal Number System
Base-16, hex to binary and decimal conversion.
Every microcontroller datasheet, memory map, and hardware register uses hexadecimal notation. Understanding hex is non-negotiable for reading CPU instruction encodings, peripheral base addresses, and embedded firmware.
Core Concept
The hexadecimal system uses base 16. It has sixteen symbols: 0 through 9, then A through F representing decimal 10 through 15. Each single hex digit maps exactly to a 4-bit nibble.
This 1:4 mapping is the key advantage. A 32-bit processor address like 0xBFFF0000 is far more readable than its 32-bit binary equivalent. CPU datasheets, UART baud-rate registers, and I2C device addresses all use hex notation for this reason.
In embedded C and assembly, hex constants are written with the prefix 0x (e.g., 0x1A3C). In GATE problems hex values may also appear as (2AF3)₁₆. The radix subscript confirms the base.
Boolean Expression
The positional value formula is: N = dₙ × 16ⁿ + ... + d₁ × 16¹ + d₀ × 16⁰. Each digit dᵢ is in the range 0–15. For letter digits, substitute A=10, B=11, C=12, D=13, E=14, F=15 before multiplying.
Given:
Convert (3B7)₁₆ to decimal
Formula / Rule:
N = d₂×16² + d₁×16¹ + d₀×16⁰
Step by step:
d₂ = 3, d₁ = B = 11, d₀ = 7
3 × 256 = 768
11 × 16 = 176
7 × 1 = 7
768 + 176 + 7 = 951
Final Answer:
(3B7)₁₆ = (951)₁₀Exam Tip: The most common GATE trap is forgetting that A=10 not 1 and 0. Students also confuse (1A)₁₆ = 26₁₀ with 1A meaning 1 and A separately. Another trap: when converting decimal to hex, divide repeatedly by 16 and read remainders bottom-up. Reading remainders top-down is the classic error.
Key Properties
- Base 16 system; 16 unique symbols per digit position
- One hex digit represents exactly 4 binary bits (one nibble)
- Two hex digits represent one byte (8 bits), range 00 to FF
- Widely used in memory addressing: x86 segment:offset and ARM Cortex-M peripheral base addresses
- Hex to binary conversion: replace each hex digit with its 4-bit group, no calculation needed
- Binary to hex: group binary digits in sets of 4 from LSB side, convert each group
- Hex arithmetic follows standard carry rules but carry occurs at 16, not 10
Quick Revision
- Base 16; digits 0–9 and A–F
- A=10, B=11, C=12, D=13, E=14, F=15
- 1 hex digit = 4 bits; 2 hex digits = 1 byte
- Hex to decimal: multiply each digit by 16 raised to its position
- Decimal to hex: divide by 16, collect remainders from bottom to top
- Hex to binary: each digit directly expands to a 4-bit group
- Used in UART, SPI, I2C register maps and CPU memory-mapped I/O
- Exam trap: reading the repeated-division remainders in the wrong order gives the reversed hex digit sequence
Hexadecimal Number System
Test your ability to convert between hexadecimal, binary, and decimal representations.
Q1.The hexadecimal number 2AF converted to decimal is:
Related Articles
Binary Number System
Base-2, place values, binary to decimal conversion.
9 min read
Signed Number Representation
Sign magnitude, 1s complement, 2s complement, range.
10 min read
Binary Subtraction
Direct subtraction and complement methods.
8 min read
BCD Code
Binary coded decimal, valid and invalid BCD, BCD addition.
12 min read
Binary Addition
Rules of binary addition, carry propagation.
11 min read