Powers of 2 Reference

PowerDecimalBinaryHexUse
2⁰111
2⁴161000010Hex digit
2⁸2561000000001001 Byte max+1
2¹⁰1,024100000000004001 KB
2¹⁶65,53610000Port range
2²⁰1,048,5761000001 MB
2³²4,294,967,296IPv4 addresses

How Binary Works

Binary uses two digits — 0 and 1 — where each position is a power of 2. The rightmost bit is 2⁰ (value 1), moving left: 2¹ (2), 2² (4), 2³ (8). Example: 1010 = 0×1 + 1×2 + 0×4 + 1×8 = 10 in decimal.

Bitwise Operations

AND (&): both bits must be 1 to return 1. OR (|): at least one bit is 1. XOR (^): bits must differ to return 1. These are CPU-level primitives used in flags, masks, and cryptographic algorithms.