Binary Conversion Formulas
Convert numbers between binary, decimal, and hexadecimal systems.
Essential for programming and digital electronics.
The Formula
Binary to Decimal: dₙ×2ⁿ + dₙ₋₁×2ⁿ⁻¹ + ... + d₁×2¹ + d₀×2⁰
Every number system uses positional notation where each digit's value depends on its position. Binary uses base 2, decimal uses base 10, and hexadecimal uses base 16.
Variables
| Symbol | Meaning |
|---|---|
| d | Digit value at each position |
| base | Number system base (2 for binary, 10 for decimal, 16 for hex) |
| position | Position index (starting from 0 on the right) |
Example 1
Convert binary 11010110 to decimal
1×2⁷ + 1×2⁶ + 0×2⁵ + 1×2⁴ + 0×2³ + 1×2² + 1×2¹ + 0×2⁰
128 + 64 + 0 + 16 + 0 + 4 + 2 + 0
11010110₂ = 214₁₀
Example 2
Convert decimal 255 to binary and hexadecimal
255 ÷ 2 = 127 R1, 127 ÷ 2 = 63 R1, ... (all remainders are 1)
Binary: 11111111
Hex: F = 15 in decimal, and 255 = 15×16 + 15
255₁₀ = 11111111₂ = FF₁₆
When to Use It
Use binary conversion when:
- Working with low-level programming or embedded systems
- Reading or writing memory addresses and color codes
- Understanding how computers store and process numbers
- Debugging bitwise operations in code