Powers of Two Reference Table

2 to the 0 through 2 to the 63 with decimal and hex values.

Reference table of powers of two from 2^0 up to 2^256, showing each value in decimal and hexadecimal with binary-prefix labels (KiB, MiB, GiB). Exact BigInt values you can copy for bit masks, buffer sizes, and limits. It runs free in your browser on Gera Tools, with nothing uploaded.

Last updated Source: Gera Tools

Why do powers of two matter in computing?

Computers store data in bits, so capacities, address ranges, and limits cluster on powers of two. A byte holds 2^8 = 256 values and a 32-bit unsigned integer maxes out at 2^32 - 1, which is why these exact numbers come up constantly.

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:

ExponentDecimalCommon meaning
2^7128Max positive value in signed 8-bit int
2^8256Total values in a byte (0–255)
2^101 0241 KiB — smallest named binary unit
2^1665 536Max unsigned 16-bit integer; port number range
2^2416 777 21616M distinct colours in 24-bit RGB
2^312 147 483 648Max positive signed 32-bit integer
2^324 294 967 296Total unsigned 32-bit values; IPv4 address space
2^539 007 199 254 740 992MAX_SAFE_INTEGER in JavaScript (float64 precision limit)
2^64~1.84×10^19Max 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.