Select Page

The binary or base-2 numbering system may be regarded as the ‘natural’ numbering system to use with digital computers, since the low or high logic levels used internally by digital circuits correspond directly with the 0 or 1 values of a binary number.

In the binary numbering system, each digit is worth twice as much as the digit immediately to its right and can take a value of either 1 or 0. A single binary digit is normally referred to as a bit (a contraction of BInary digiT).

The following table shows the counting sequence when a binary number is used to represent a sequence of positive integers.

Binary Value Decimal Value
Bit 4
(16)
Bit 3
(8)
Bit 2
(4)
Bit 1
(2)
Bit 0
(1)
Digit 1
(10)
Digit 0
(1)
0 0 0 0 0 0 0
0 0 0 0 1 0 1
0 0 0 1 0 0 2
0 0 0 1 1 0 3
0 0 1 0 0 0 4
0 0 1 0 1 0 5
0 0 1 1 0 0 6
0 0 1 1 1 0 7
0 1 0 0 0 0 8
0 1 0 0 1 0 9
0 1 0 1 0 1 0
0 1 0 1 1 1 1
0 1 1 0 0 1 2
0 1 1 0 1 1 3
0 1 1 1 0 1 4
0 1 1 1 1 1 5
1 0 0 0 0 1 6
1 0 0 0 1 1 7

A disadvantage when reading or writing binary numbers is that long strings of ones and zeroes are difficult to read, hence direct use of the binary numbering system by humans is prone to error. This problem can be reduced somewhat if binary numbers are arranged in groups of four bits, starting at the right hand side. For example the binary number 0111 1101 1111 11102 is much easier to read than 01111101111111102.

Further simplification may be achieved by conversion to octal or hexadecimal, which reduces the number of digits in a binary number by a factor of three or four times, respectively.

## Range of a Binary Number

As a general rule, the range of an N-bit integer number is 2N, or 0 to (2N−1). For example the range of an 8-bit number is 28 or 256 (0–255). The following table lists the most commonly encountered binary integer number types and their characteristics.

Type Bits Range
Bit 1 2 (0–1)
Nibble 4 16 (0–15)
Byte 8 256 (0–255)
Word(*) 16 65,536 (0–65,535)

Terminology varies related to integer number types with 16 or more bits. The appropriate documentation should be studied to identify any implementation-specific terminology or conventions.

## Converting between Binary and Decimal

Digital computers use the binary numbering system internally while humans prefer to count in the more familiar base-10. Thus it is useful to be able to convert numbers from one number base to another.

#### Converting from Binary to Decimal

Begin by writing the decimal value above each digit of the binary number, as shown in the example below.

Next, add together the values of those digits which are non-zero. Hence, for the example shown, it can be seen that 1 01112 is equivalent to 2310.

#### Converting from Decimal to Binary

There are two commonly used manual methods. See which you prefer.

Method A:

Identify the largest power of two (1,2,4, etc.) which is less than or equal to the original base-10 number. Set this bit to one in the binary number. Now subtract this power of two from the original number, leaving a remainder. Repeat this process until there is no remainder. The following example converts the decimal number 8510 to binary, giving a result of 101 01012.

Method B:

This second technique uses repeated division by two, with the remainders at each stage forming the binary number. The repeated division continues until the quotient becomes zero. The example below converts a decimal value of 15510 to binary, giving a result of 1001 10112

See the Numbering Systems Problems page for additional practice activities. Windows users may check their results by using the Windows Calculator in programmer’s view.