Every number a computer holds is a row of switches, each either on (1) or off (0). Each switch is worth double the one to its right, so the row below is the number — the four boxes on the left are just four ways of writing it down. Click any switch to change it and watch all four move.
Neither number is wrong. The drive really does hold a million million bytes; Windows really is dividing by 1024 three times and calling the answer GB. The two families were reconciled in 1998 — IEC 80000-13 gave the binary ones their own names (kibi, mebi, gibi) — and almost nobody adopted them, so the same three letters still mean two things about 7% apart at terabyte scale. macOS and Linux report decimal GB; Windows reports binary and labels it GB.
Every one of them is the same idea: a row of digits where each place is worth a fixed multiple of the place to its right. What changes is the multiple — ten, sixteen, eight or two — and that single choice decides everything else about how the notation behaves.
Sixteen is 24 and eight is 23. That is the whole reason both bases exist. Because the base is a power of two, a fixed block of bits maps onto exactly one digit and nothing ever carries between blocks — you can read a hex digit off four bits without looking at any of the others, and write it back the same way.
Ten is not a power of two. So there is no block of bits that corresponds to a decimal digit, no way to read one off without considering the whole number, and converting to decimal is the only one of the four that requires actual division. It is why a programmer reads 0xB4 off a byte at a glance and has to think about 180.
Hex won because 4 divides 8: two hex digits are exactly one byte, forever. Octal does not — three bits do not divide eight, so the top octal digit of a byte is always a stunted two-bit one. Octal made perfect sense on the 12, 18 and 36-bit machines that came before bytes settled at eight, and it survives mostly in Unix file permissions, where the fields genuinely are three bits wide: read, write, execute.
Take the digits from the right. The rightmost is worth 1, the next is worth the base, the next the base squared, and so on. Multiply each digit by its place and add them up. That is the entire algorithm, and it is identical in all four:
| Base | Places, right to left | Digits used | Bits per digit |
|---|---|---|---|
| Binary (2) | 1, 2, 4, 8, 16, 32… | 0–1 | 1 |
| Octal (8) | 1, 8, 64, 512… | 0–7 | 3 |
| Decimal (10) | 1, 10, 100, 1000… | 0–9 | — |
| Hex (16) | 1, 16, 256, 4096… | 0–9, A–F | 4 |
The bits per digit column is the useful one. It is blank for decimal because there is no answer — and that blank is the practical difference between the bases a computer person uses and the one everybody else does.
A bit is one 0/1. Four make a nibble (one hex digit); eight a byte (two hex digits, 0–255). Word sizes are stacks of bytes: 8, 16, 32 or 64 bits.
Each hex digit is exactly one nibble, so binary and hex swap 4-to-1 with no arithmetic. 0xB4 is 1011 0100 at a glance.
Fixed word sizes drop anything above the top bit, so values wrap modulo 2n. Every result is masked to the word size, like a CPU register: 255 + 1 = 0 in a byte.
AND keeps bits set in both, OR in either, XOR where they differ. The building blocks of flags, masks and permissions; the lab shows each result bit forming column by column.
Almost every diagram puts the most significant bit on the left, because that is how we write numbers. Serial links shift out least-significant-first, bit-reversed FFT orders exist for a reason, and plenty of datasheets number from the other end. Reading a diagram the wrong way round is one of the easier ways to lose an afternoon.
There are two controls because they are two questions: read direction (which end the word is read from, and the order bits are dealt round the lanes) and where bit 0 sits (only the drawing). Neither changes the value, and neither is the same as reversing the bits, which does.
A 26-bit field, a 12-bit ADC reading, a 20-bit address bus, a 5-bit register field: a grid built from byte rows cannot draw any of them. A 26-bit value needs seven hex digits, and was once padded to six and a half, so the top two bits fell off the readout. Byte swap is now off below a whole byte, because with no bytes to reverse a control that looks available is worse than one that is visibly off.
Interleaved data is dealt round its consumers one bit at a time: RAID stripes, memory channels, SIMD lanes, LED driver chains. Lane i gets positions i, i+n, i+2n, so what one consumer sees is scattered through the word. When the lane count does not divide the width the last lanes come up one bit short, drawn rather than padded, because that asymmetry is what bites. The dealing is checked by dealing the bits out and picking them back up at every width from 1 to 64 and every lane count from 1 to 12, both directions: 1,800 combinations, each returning the value it started with.
A word size is a fixed number of bits. Anything past the top bit has nowhere to go, so it's dropped — the value "wraps" modulo 2ⁿ. That's exactly what a CPU register does, and it's why 255 + 1 = 0 in a byte.
The standard way to store negative integers: the top bit carries a negative weight. In a byte, values 0–127 are themselves; 128–255 represent −128 to −1. Switch to signed to see it — the bits don't change, only how the decimal is read.
One hex digit maps to exactly four bits (a nibble), so a byte is two clean hex digits. Octal packs three bits per digit, which doesn't line up with 8-bit bytes — handy for old systems and Unix permissions, but hex fits modern hardware better.
JavaScript's normal bitwise operators only work on 32 bits. This tool uses BigInt for everything, so 64-bit shifts, rotates and masks are exact — no silent truncation.
The bit grid and bitwise lab take whole numbers only — no fractions and no floating point, which has an entirely different bit layout. The size and rate sections further down are ordinary decimal arithmetic and do accept fractions. Signed values use two’s complement, and the selected word size wraps around rather than reporting an error, exactly as hardware does. Byte order (endianness) does not appear here at all: it affects how a value is laid out in memory or sent over a wire, not what the value is.
Releases in which this page changed, newest last. Derived from the archived copy of every release, not from notes written afterwards — so it reflects what actually shipped. Site-wide passes are left out; they are in the full changelog.