# What is a bit?

toggle-button

A bit (b) is the basic unit of almost every modern computer system. The word bit is a contraction of the term binary digit.

A bit is the building block for the numbers, languages, and almost every aspect of computer operation. It is also the smallest (irreducible) unit of information in those computers.

A binary unit can only have two values or logical states, typically the values are 0 and 1. But the values could also be 'Off' and 'On', 'False' and 'True' or 'No' and 'Yes'.

You will notice that I have reversed the common convention of listing the positive value first. Normally, we would say 'On' and 'Off', 'True' and 'False', etc. The reason I have done this is to emphasize that the initial, default or unassigned state of a bit is normally zero or not set.

That is enough information to understand what a bit is. Read on if you want more understanding of binary systems, binary numbering and bit-length.

#### There are many binary systems in the world arounds us

The following table illustrates some other examples of binary systems.

 Table 1 — Binary systems have two discrete states State 1 State 2 Logic False True Decision making No Yes Electrical switch Off On Electrical charge - Negative + Positive Probability 0% 100% Morse code · Dot – Dash Door Closed Open Lever Down Up Level Low High

#### Binary systems are used to store information

In 1725, a textile loom was partially automated by using patterns recorded by punching holes in a paper roll. The loom was programmed by using the pattern to guide the machine. The nineteenth-century piano roll operates on the same principle.

Two principles underly this method of storing and processing information:

1. The pattern is stored even when the machine is not processing the pattern.
2. When the machine is operating, nothing happens or changes unless there is a transition from no hole to a hole or from a hole to no hole. That is almost exactly what happens in modern computer processing. We just use electrical signals and newer types of media.

Those early paper rolls are part of the development of storage media that ultimately led to the media we use today.

 Table 2 — Binary storage media State 1 State 2 Paper tape (since 1725 but now obsolete) No hole Hole Cards (since 1728 but now obsolete) No hole Hole Magnetic tape (since 1951 but tending to become obsolete) Not magnetized Magnetized Magnetic memory (since 1951 but new developments) Not magnetized Magnetized Magnetic disk (since 1956) Not magnetized Magnetized Magnetic stripe card (since 1960 but increasingly chip-based) Not magnetized Magnetized Optical disk (since 1970, e.g. CD, DVD, BD) No pit Pit

#### Binary counting is used to create more than two values

With one bit we can have two values. To get more than two values we can combine bits to create larger values.

The value of a computer bit is a binary or Base-2 number, 0 or 1. The numbers we normally use are the decimal or Base-10 digits (0, 1, 2, 3, 4, 5, 6, 7, 8, 9) so counting looks very different in binary as shown in the following table. As we join bits together we can make larger binary numbers.

Our decimal system has a decimal progression where the order of magnitude is 10: 1, 10, 100, 1,000, 10,000, 100,000, 1,000,000, etc. The equivalent binary progression where we join bits together is also 10, 100, 1000, 10000, 100000, 1000000, etc. but the order of magnitude is only 2 so the decimal equivalents are a lot less: 2, 4, 8, 16, 32, 64, 128, 256, 512, 1,024 etc.

 Table 3 — Counting in binary Number of bits Binary Base-2 Decimal Base-10 Hexadecimal Base-16 1 0 0 0 1 1 1 2 10 2 2 11 3 3 3 100 4 4 101 5 5 110 6 6 111 7 7 4 1000 8 8 1001 9 9 1010 10 A 1011 11 B 1100 12 C 1101 13 D 1110 14 E 1111 15 F 5 10000 16 10

At this point, I've introduced hexadecimal (Base-16, 4-bit) values because you are likely to see these numbers in many places. Large binary numbers are unweildy and very hard to remember so hexadecimal has been a useful way to remember them. For example, decimal 42 is not too hard to remember as binary 101010 or hexadecimal 2A. But decimal 1,000,000 is very hard to remember as binary 11,110,100,001,001,000,000 but much easier as hexadecimal F4240.

We can indicate the Base for any number by appending it as a subscripted number. For example, binary 100002 = decimal 1610 = hexadecimal 1016. This is equivalent to the last row of Table 3 above.

#### Try binary counting for yourself

Try binary counting using your fingers. With ten fingers you can store 210 = 1,024 values.

• 0 = finger down
• 1 = finger up

Why can I count much higher than using my fingers for decimal counting? When counting in decimal the number zero only needs to be represented by one finger but instead we use all ten so nine add no additional information. Binary counting is the most efficient method to use two finger positions because both finger positions always indicate unique values.

If you use three finger positions then ternary or trinary counting will work better. Binary counting can still be used but it will only be easy if the number of finger positions is a multiple of two. So four positions would give 1,048,576 values. That is 1,024 multiplies by 1,024 .

#### Try binary numbering using Windows Calculator

You can also try the various numbering systems for yourself using Windows Calculator.

From the Start Menu, select 'All programs', select 'Accessories', select 'Calculator'.

When the Calculator window appears, on the main menu select 'View'. On the drop-down menu select 'Programmer' for Windows Vista to 7 or select 'Scientific' for Windows XP. Here you can enter digits in Decimal, Hexadecimal, Binary, and even Octal which is Base-8. For example, with the Dec button selected, type in the number 42 then select the button for the number system you want to view. Calculator displays the equivalent value for the number system you select.

#### Bit numbers you are likely to see on computer systems

Now let's have a look at some of the numbers you are likely to see on computer systems when you join bits together. If I have eight bits joined together then I can create an 8-bit value, with sixteen bits I can create a 16-bit value, and so on.

There are two values that you are likely to meet for each bit-length:

• The number of values that can be represented by that bit-length as shown in Table 4
• The actual values that can be stored by that bit-length as shown in Table 5.

The largest number that can be stored will be one less than the number of values because, as I said earlier, the default state for a bit is 0 so the first value will be zero. Using memory locations as an example, if I have 65,536 memory locations then the memory addresses will normally be from 0 to 65,535. The upper limit being one less than the number of memory locations.

Note that binary and hexadecimal representations don't use commas to separate every third order of magnitude as decimal does. Instead they tend to separate every fourth order (as four is a multiple of two) with a space or colon.

 Table 4 — The number of values for a given bit-length Number of bits Decimal Base-10 Hexadecimal Base-16 8 256 100 16 65,536 1 0000 32 4,294,967,296 1 0000 0000 64 18,446,744,073,709,551,616 1 0000 0000 0000 0000

Now let's have a look at some of the numbers you are likely to see on computer systems when you join bits together. If I have eight bits joined together then I can create an 8-bit value, with sixteen bits I can create a 16-bit value, and so on.

 Table 5 — The range of values for a given bit-length Number of bits Decimal Base-10 Hexadecimal Base-16 8 0 to 255 0 to FF 16 0 to 65,535 0 to FFFF 32 0 to 4,294,967,295 0 to FFFF FFFF 64 0 to 18,446,744,073,709,551,615 0 to FFFF FFFF FFFF FFFF

#### More binary numbers that you are likely to see

These numbers are smaller and are more likely to be seen in the detail of computing. They can be seen when editing disk data, viewing memory ranges, and working in the Windows registry.

 Table 6 — The number of values available for a given bit-length Number of bits Binary Base-2 Decimal Base-10 Hexadecimal Base-16 1 1 1 1 10 2 2 2 100 4 4 3 1000 8 8 4 1 0000 16 10 5 10 0000 32 20 6 100 0000 64 40 7 1000 0000 128 80 8 1 0000 0000 256 100 9 10 0000 0000 512 200 10 100 0000 0000 1,024 400 11 1000 0000 0000 2,048 800 12 1 0000 0000 0000 4,096 1000 13 10 0000 0000 0000 8,192 2000 14 100 0000 0000 0000 16,384 4000 15 1000 0000 0000 0000 32,768 8000 16 1 0000 0000 0000 0000 65,536 1 0000

As I said above, the lowest value is usually zero so the largest number will be one less than the number of values. These numbers look a lot different than in Table 6.

 Table 7 — Maximum value for a given bit-length Number of bits Binary Base-2 Decimal Base-10 Hexadecimal Base-16 1 0 0 0 1 1 1 2 11 3 3 3 111 7 7 4 1111 15 F 5 1 1111 31 1F 6 11 1111 63 3F 7 111 1111 127 7F 8 1111 1111 255 FF 9 1 1111 1111 511 1FF 10 11 1111 1111 1,023 3FF 11 111 1111 1111 2,047 7FF 12 1111 1111 1111 4,095 FFF 13 1 1111 1111 1111 8,191 1FFF 14 11 1111 1111 1111 16,383 3FFF 15 111 1111 1111 1111 32,767 7FFF 16 1111 1111 1111 1111 65,535 FFFF