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.
Tips and example
- An unsigned 8-bit byte holds
2^8 = 256distinct values (0–255); a 16-bit value holds2^16 = 65536. - In hex, each factor of 16 shifts by four bits:
2^4is0x10,2^8is0x100,2^12is0x1000— a quick way to sanity-check bit masks. - The gap between binary and decimal prefixes grows: a “1 TB” drive (10^12 bytes) is only about
0.909TiB (2^40bytes), which is why advertised and reported sizes differ.
Copy the exact value you need straight into a constant or a comment without retyping a long number.