A Pocket Binary Lantern

Type a whole number from 0 to 255 and watch its eight-bit binary form appear as eight lamps.

Digits only. Leading zeros and spaces around the number are fine, for example 0042.

Decimal: 42

Binary (8 bits, most significant first): 00101010

  1. 1280off
  2. 640off
  3. 321lit
  4. 160off
  5. 81lit
  6. 40off
  7. 21lit
  8. 10off

Lit weights: 32 + 8 + 2 = 42

How to read the lamps

Each position has a fixed weight: 128, 64, 32, 16, 8, 4, 2, 1. A lit lamp (bit 1) contributes its labelled weight; an unlit lamp (bit 0) contributes nothing. Add the weights of the lit lamps and you get the decimal number.

The lamps are only a picture of the bits, not an electronics simulation. Every lamp also shows its 0 or 1, so colour is never needed to read it.