Powers of two are the backbone of how computers measure and address everything: memory sizes, integer limits, bit flags, and color depths all land on a power of two. This reference lists 2 raised to each exponent in decimal and hexadecimal, marks the binary-prefix boundaries, and lets you copy any exact value.
How it works
Each row is computed by repeated doubling, starting from 2 to the power 0:
2^0 = 1
2^(n+1) = 2 × 2^n
The decimal column is the value itself; the hex column is the same number in base 16, where powers of two are especially tidy. Binary prefixes attach at the round exponents — 2^10 is one kibibyte (KiB), 2^20 is one mebibyte (MiB), 2^30 is one gibibyte (GiB), and so on up through PiB, EiB, ZiB, and YiB. Every value uses BigInt, so even 2^256 prints its full 78-digit integer exactly.
Why powers of two appear in programming
Every data type in a binary computer is defined by its bit width, and bit widths are powers of two. A few values show up constantly:
| Exponent | Decimal | Common meaning |
|---|---|---|
| 2^7 | 128 | Max positive value in signed 8-bit int |
| 2^8 | 256 | Total values in a byte (0–255) |
| 2^10 | 1 024 | 1 KiB — smallest named binary unit |
| 2^16 | 65 536 | Max unsigned 16-bit integer; port number range |
| 2^24 | 16 777 216 | 16M distinct colours in 24-bit RGB |
| 2^31 | 2 147 483 648 | Max positive signed 32-bit integer |
| 2^32 | 4 294 967 296 | Total unsigned 32-bit values; IPv4 address space |
| 2^53 | 9 007 199 254 740 992 | MAX_SAFE_INTEGER in JavaScript (float64 precision limit) |
| 2^64 | ~1.84×10^19 | Max unsigned 64-bit integer |
Binary vs decimal prefixes: the source of the confusion
Hard drive manufacturers measure storage in SI (decimal) units: 1 TB = 10^12 bytes. Operating systems measure in binary units: 1 TiB = 2^40 bytes ≈ 1.0995 × 10^12 bytes. The gap grows with scale:
- 1 GB (advertised) = 1,000,000,000 bytes
- 1 GiB (OS reports) = 1,073,741,824 bytes ≈ 7.4% more
A drive labelled “1 TB” shows up as “931.3 GB” in Windows File Explorer, which is reporting in GiB using the GB label. This discrepancy is entirely due to the binary vs decimal prefix convention, not missing storage.
Reading powers of two in hexadecimal
Powers of two are exceptionally clean in hex because each additional factor of 16 (2^4) appends exactly one zero:
2^4 = 0x10
2^8 = 0x100
2^12 = 0x1000
2^16 = 0x10000
2^32 = 0x100000000
Bit masks are easy to spot: 0xFF is 2^8 - 1 (8 bits set), 0xFFFF is 2^16 - 1, and so on. This makes the hex column useful for quickly deriving and checking bitmask values in code.
Cryptographic exponents
For RSA keys and cryptographic key spaces, the meaningful values lie at 2^128 (common AES key size), 2^192, and 2^256 (SHA-256 output space). These numbers are enormous — 2^128 is roughly 3.4 × 10^38 — and are the reason brute-forcing a well-chosen key is computationally infeasible even with vast hardware. This table renders them exactly using BigInt arithmetic rather than truncating to floating-point approximations.