Author: Udi Aharoni      Illustrations: Gil Troitsa

A book for computer-loving kids 9+


Binary and hexadecimal numbers

Throughout the book the term “bit” is mentioned to refer to the digit 0 or 1. Here’s an interactive demo explaining how bits are used to represent numbers. Also, as the book’s characters drive around the hard drive in chapter 9, the driver mentions Hexadecimal numbers. We’ll explain them here too.

Here are four different kinds of counters. Click the + and – buttons below to experiment with them.

The decimal counter should be pretty familiar. It simply shows the number of rectangles at the bottom panel in the usual fashion.

We designed it to look like a mechanical counter: it is made of 3 wheels, each one having the digits 0, 1, 2, 3, 4, 5, 6, 7, 8, 9. Here’s a picture of how one wheel looks like:

Digit wheel of a mechanical decimal counter

Every time you click +, the first (right) wheel advances to the next digit: from 0 to 1, then from 1 to 2, etc. When the first wheel completes a whole round and returns to 0, the second wheel advances to the next digit, and so on.

The binary counter is very similar. The only difference is that each wheel has only two digits: 0 and 1. When you click + the first wheel rotates from 0 to 1. When you click again, the first wheel already completes a whole round and returns to 0, which means the second wheel now rotates from 0 to 1, and so on.

This counter too counts the number of rectangles in the bottom panel, but it shows this number in a different representation, called the a binary number, or base-2 numerals. When it shows “1 0” it doesn’t mean ten, as in the decimal counter, it means two.

Digital devices prefer to use binary numbers, since it’s easy to represent them using electrical wires, where current in a wire can be on (=1) or off (=0). When these devices display numbers on screen the usually convert them to decimal, so that humans will be able to read them more easily.

Sometimes though digital devices display numbers in hexadecimal representation, or base-16 numerals. The third counter above shows how they look like. Here every wheel has 16 digits: the usual ones, 0,1,2,3,4,5,6,7,8,9, then six more: A, B, C, D, E, F. The additional six use letter symbols, but they are still just digits. Any symbol can be used for the digits, it doesn’t matter.

The bottom panel which simply shows the number as a sequence of rectangles is called a unary counter. Using a single symbol to represent a number by simply repeating it over and over again is called the unary numeral system. It is not very convenient to use of course, since it requires a lot of writing when the numbers get large.

Next on our tour: how logic gates are used to manipulate binary numbers.


Or visit for the author’s home page with animated videos