# Binary numeral system

The binary numeral system is a base-2 numeral system, that is, a system with only two symbols, 0 and 1.

Binary numbers are used in digital electronic circuits in computer-based devices, where they can direct switches, or so-called logic gates, either to be turned on or turned off.

In computer science one binary digit is usually called a “bit”.

## How does the binary numeral system work?

Binary numbers are counted the same way as numbers of the decimal numeral system, but where each digit of a decimal number can have ten different values, because there are ten different symbols (0,1,2,3,4,5,6,7,8,9), each digit of a binary number can have only two values (0 and 1).

Like in the decimal numeral system the first numbers only have one digit, which increases by one at a time. When all symbols for that digit have been used, the digit turns back into the first symbol in line again, which is 0, and another digit is added to the left of it. The new added digit starts with the second symbol in line, which is 1, and increases by one every time the first digit has made a round of symbols and so forth.

Example

The table shows how to count from 0 to 8 in the binary numeral system.

 Decimal numbers Binary numbers 0 0 1 1 2 10 3 11 4 100 5 101 6 110 7 111 8 1000

In the decimal numeral system you increase the number of possible combinations of numbers tenfold, for each digit you add. With one digit you can make 10 different numbers (0,1,2,3,4,5,6,7,8,9). With two digit you can make 102=100 different numbers (0-99). With three digits you can make 103=1000 different combinations of numbers (0-999) and so forth. So the number of possible combinations of numbers, you can make, is given by powers of 10. The power increases by one for each digit you add.

In the binary numeral system you get only twice as many combinations of numbers, every time you add a digit. So each digit you add gives an increase of combinations of numbers given by powers of 2. With one digit you can make 2 numbers (0 and 1). With two digits you can make 22=4 different numbers (0,1,10 and 11) and so forth.

## Conversion from decimal to binary numeral system

As explained above each digit of the binary numeral system has a value given as powers of 2, indicating how many combinations of numbers you can make, when that digit is added.

In order to convert numbers from decimal to binary numeral system, you have to make a list of these values in reverse order.

 Number of digit 10 9 8 7 6 5 4 3 2 1 0 Powers of 2 Value in decimal numeral system Binary digit

Then you work your way systematically through the number from left to right.

For example, we want to convert 233 to a binary number.

You make the table like the one above, but only with the “Values in decimal numeral system” that are smaller than 233, that is, from 128 down.

 128 64 32 16 8 4 2 1

Then we go through the numbers from left to right.

Is 233 greater than or equal to 128? Yes it is, and we write 1 in the field below 128.

 128 64 32 16 8 4 2 1 1

Then we calculate 233 - 128 = 105

Is 105 greater than or equal to 64? Yes it is, and we write 1 in the field below 64.

 128 64 32 16 8 4 2 1 1 1

and calculate 105 - 64 = 41

Is 41 greater than or equal to 32? Yes it is, and we write 1 in the field below 32.

 128 64 32 16 8 4 2 1 1 1 1

and calculate 41 - 32 = 9

Is 9 greater than or equal to 16? No it isn’t, and we write 0 in the field below 16.

 128 64 32 16 8 4 2 1 1 1 1 0

Is 9 greater than or equal to 8? Yes it is, and we write 1 in the field below 8.

 128 64 32 16 8 4 2 1 1 1 1 0 1

and calculate 9 - 8 = 1

Is 1 greater than or equal to 4? No it isn’t, and we write 0 in the field below 4.

 128 64 32 16 8 4 2 1 1 1 1 0 1 0

Is 1 greater than or equal to 2? No it isn’t, and we write 0 in the field below 2.

 128 64 32 16 8 4 2 1 1 1 1 0 1 0 0

Is 1 greater than or equal to 1? Yes it is, and we write 1 in the field below 1.

 128 64 32 16 8 4 2 1 1 1 1 0 1 0 0 1

So 233 converted to binary number is 11101001.

## Conversion from binary to decimal numeral system

If you want to convert a number from binary to decimal numeral system, you need to add together the value of each number 1 appearing in the number.

For example, we want to convert 101101 to decimal number.

Value6432168421
Binary digits1011001

We add together the values of all number 1 appearing in the number:

64 + 16 + 8 + 1 = 89

So the binary number 1011001 is equal to the decimal number 89.

## Conversion between binary and decimal numbers

 Binary number: Dicimal number: