How to Convert Number Bases
Step-by-Step Conversion Guide
Learn ConversionsConverting between number bases is a fundamental skill in computing. Whether you're working with binary, hexadecimal, octal, or decimal, the methods are systematic and learnable. This guide walks through each conversion with clear steps and examples.
Decimal to Binary
Method: Repeated Division by 2
- Divide the number by 2
- Record the remainder (0 or 1)
- Divide the quotient by 2
- Repeat until quotient is 0
- Read remainders bottom-to-top
Example: Convert 156 to Binary
| Division | Quotient | Remainder |
|---|---|---|
| 156 ÷ 2 | 78 | 0 |
| 78 ÷ 2 | 39 | 0 |
| 39 ÷ 2 | 19 | 1 |
| 19 ÷ 2 | 9 | 1 |
| 9 ÷ 2 | 4 | 1 |
| 4 ÷ 2 | 2 | 0 |
| 2 ÷ 2 | 1 | 0 |
| 1 ÷ 2 | 0 | 1 |
Reading bottom-to-top: 156₁₀ = 10011100₂
Binary to Decimal
Method: Positional Values
- Write position values (powers of 2) under each digit
- Multiply each digit by its position value
- Add all products
Example: Convert 10011100 to Decimal
| Binary digit | 1 | 0 | 0 | 1 | 1 | 1 | 0 | 0 |
|---|---|---|---|---|---|---|---|---|
| Position value | 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
| Product | 128 | 0 | 0 | 16 | 8 | 4 | 0 | 0 |
Sum: 128 + 16 + 8 + 4 = 156₁₀
Decimal to Hexadecimal
Method: Repeated Division by 16
- Divide by 16, record remainder
- Convert remainders 10-15 to A-F
- Read remainders bottom-to-top
Example: Convert 748 to Hexadecimal
| Division | Quotient | Remainder | Hex Digit |
|---|---|---|---|
| 748 ÷ 16 | 46 | 12 | C |
| 46 ÷ 16 | 2 | 14 | E |
| 2 ÷ 16 | 0 | 2 | 2 |
Reading bottom-to-top: 748₁₀ = 2EC₁₆
Hexadecimal to Decimal
Method: Positional Values
- Convert A-F to 10-15
- Multiply each digit by its position value (powers of 16)
- Add all products
Example: Convert 2EC to Decimal
- 2 × 16² = 2 × 256 = 512
- E (14) × 16¹ = 14 × 16 = 224
- C (12) × 16⁰ = 12 × 1 = 12
Sum: 512 + 224 + 12 = 748₁₀
Binary to Hexadecimal
Method: Group and Convert
- Group binary digits into sets of 4 (from right)
- Pad with leading zeros if needed
- Convert each group to its hex digit
Example: Convert 10011100 to Hexadecimal
- Group: 1001 | 1100
- 1001 = 9
- 1100 = C
Result: 10011100₂ = 9C₁₆
Hexadecimal to Binary
Method: Expand Each Digit
- Convert each hex digit to 4 binary digits
- Concatenate the results
Example: Convert A7F to Binary
- A = 1010
- 7 = 0111
- F = 1111
Result: A7F₁₆ = 101001111111₂
Octal Conversions
Binary to Octal
Group binary digits in sets of 3 (from right):
- 110 101 011 (add leading zeros: 0 110 101 011)
- 110 = 6, 101 = 5, 011 = 3
- Result: 653₈
Octal to Binary
Convert each octal digit to 3 binary digits:
- 653₈
- 6 = 110, 5 = 101, 3 = 011
- Result: 110101011₂
Decimal to Octal
Divide repeatedly by 8, read remainders bottom-to-top.
Any Base to Any Base
General Method
- Convert source to decimal (intermediate step)
- Convert decimal to target base
Example: Convert 3A₁₆ to Octal
Step 1: Hex to Decimal
- 3 × 16 + 10 × 1 = 48 + 10 = 58₁₀
Step 2: Decimal to Octal
- 58 ÷ 8 = 7 remainder 2
- 7 ÷ 8 = 0 remainder 7
- Result: 72₈
3A₁₆ = 72₈
Quick Reference Summary
| Conversion | Method |
|---|---|
| Decimal → Binary | Divide by 2, read remainders backward |
| Binary → Decimal | Sum (digit × power of 2) |
| Decimal → Hex | Divide by 16, read remainders backward |
| Hex → Decimal | Sum (digit × power of 16) |
| Binary → Hex | Group by 4, convert each group |
| Hex → Binary | Expand each digit to 4 bits |
| Binary → Octal | Group by 3, convert each group |
| Octal → Binary | Expand each digit to 3 bits |
Conclusion
Converting between number bases follows systematic methods: division for decimal to other bases, positional multiplication for other bases to decimal, and grouping shortcuts for binary/hex/octal conversions. With practice, these conversions become second nature. The binary-hex shortcut (4 bits per hex digit) is particularly valuable in programming and computing contexts.