Como to Converter Number Bases
Passo a Passo Conversão Guia
Learn ConversionsConverting entre number bases é a fundamental skill in computing. Whether you're trabalhando com binary, hexadecimal, octal, ou decimal, o methods são systematic e learnable. Este guia walks through cada conversão com clear steps e examples.
Decimal to Binary
Method: Repeated Division by 2
- Divide o number by 2
- Record o remainder (0 ou 1)
- Divide o quotient by 2
- Repeat until quotient é 0
- Read remainders bottom-to-top
Exemplo: Converter 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 cada digit
- Multiply cada digit by its position value
- Add todos products
Exemplo: Converter 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
- Converter remainders 10-15 to A-F
- Read remainders bottom-to-top
Exemplo: Converter 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
- Converter A-F to 10-15
- Multiply cada digit by its position value (powers of 16)
- Add todos products
Exemplo: Converter 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 e Converter
- Group binary digits into sets of 4 (from right)
- Pad com leading zeros if needed
- Converter cada group to its hex digit
Exemplo: Converter 10011100 to Hexadecimal
- Group: 1001 | 1100
- 1001 = 9
- 1100 = C
Result: 10011100₂ = 9C₁₆
Hexadecimal to Binary
Method: Expand Cada Digit
- Converter cada hex digit to 4 binary digits
- Concatenate o results
Exemplo: Converter 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
Converter cada 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.
Qualquer Base to Qualquer Base
General Method
- Converter source to decimal (intermediate step)
- Converter decimal to target base
Exemplo: Converter 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 Resumo
| Conversão | 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, converter cada group |
| Hex → Binary | Expand cada digit to 4 bits |
| Binary → Octal | Group by 3, converter cada group |
| Octal → Binary | Expand cada digit to 3 bits |
Conclusão
Converting entre number bases follows systematic methods: division for decimal to outro bases, positional multiplication for outro bases to decimal, e grouping shortcuts for binary/hex/octal conversions. Com practice, estes conversions become segundo nature. O binary-hex shortcut (4 bits per hex digit) é particularly valuable in programming e computing contexts.