Binary code (or the binary system) is om­ni­present in computer tech­no­logy, and some people may still remember it from their math lessons. This code rep­res­ents complex things with only two states. This is often difficult for people who are only familiar with the decimal system and its ten digits to un­der­stand. At the same time, binary code has its ad­vant­ages and is also necessary to know about from a technical point of view.

What is binary code?

Most people use the decimal system in which there are ten digits, ranging from 0 to 9. To express a large number, you add another “position”: so a number larger than the biggest digit in the decimal system, 9, needs a new position: “1”. Starting at the beginning we get position 1 plus the first digit of the decimal system “0”. These two digits together are displayed as 10, or “ten”. The binary system works in the same way. However, you only have two digits (or two states) available as the Latin prefix “bi” suggests: 0 and 1, on and off, light and dark, true and false. Just like in the decimal system, larger numbers are rep­res­en­ted using more positions.

Defin­i­tion

Binary code rep­res­ents in­form­a­tion by using only two different states.

People are generally familiar with the binary system in the context of computers where everything runs on ones and zeroes. This is how data is stored and com­pu­ta­tions are performed. However, this method for computing and present­ing in­form­a­tion is also used in other situ­ations. Whenever we receive in­form­a­tion through one of two states, this is basically binary code. A light on an elec­tron­ic device can tell us whether it is running by being off (state 1) or on (state 2).

By stringing these on/off states together, you can com­mu­nic­ate much more complex in­form­a­tion. For example, the writing system for the blind, Braille, is based on binary code. In this system, each character is rep­res­en­ted by a grid of six dots. The com­bin­a­tions of raised dots (1/on) and flat spaces (0/off) rep­res­ents different char­ac­ters.

The history of the binary system: from Leibniz to computer systems

While binary code was already being used in classical antiquity to com­mu­nic­ate in­form­a­tion, the binary system as we know it today was not in­tro­duced until the end of the 17th century when it was conceived by Gottfried Wilhelm Leibniz. This philo­soph­er and math­em­atician (and de facto gen­er­al­ist scholar) was looking for a method to convert logic terms (i.e. true and false) into a math­em­at­ic­al system and did so using the system of ones and zeroes still used today.

A few decades earlier, the English philo­soph­er Francis Bacon had already begun to ponder how text could be rep­res­en­ted using a binary code. A third scholar, George Boole, finally developed Boolean algebra based on the binary system about a century and a half after Leibniz. This system of logical operators is still very important in computer science today.

Fact

Similar systems were also developed in other parts of the world in­de­pend­ently of these European break­throughs in binary arith­met­ic, and sometimes much earlier. For example, the hexagrams in the Yi Jing (or I Ching) – a Chinese text from the 3rd century BC – are based on a binary code and refer to the duality of yin and yang.

In the 20th century, digital tech­no­logy was finally developed, and the first elec­tron­ic cal­cu­lat­ing machines were produced. It was the task of pioneers in computing to translate numbers and letters into a system which computers could un­der­stand. Binary code was made for this since the ab­strac­tions of 1s and 0s can be trans­lated into physical states. For example, in elec­tric­al en­gin­eer­ing, you can use 1 if there is voltage and 0 if there is no voltage.

Punch cards also use a binary system to com­mu­nic­ate in­form­a­tion. These cards can represent a certain number of char­ac­ters using a hole or a lack of a hole. This allows in­form­a­tion to be stored per­man­ently and still be machine readable. Punch cards were already being used before computers were invented, such as with looms and mech­an­ic­al music machines.

At first glance, binary code and binary system seem to be syn­onym­ous. However, once you un­der­stand what a code is, you will see the dif­fer­ence. A code is the con­trolled trans­la­tion of char­ac­ters. Each character in the original is assigned a different character or character string. This makes it possible to convert back and forth. Meanwhile, a system is self-contained and does not need to be compared to another system. For example, if you are computing using the binary system, you do not need to refer to the decimal system to get results.

Both can be found in elec­tron­ic data pro­cessing (EDP). For example, this coding can be found in ASCII code. All letters in the Latin alphabet as well as some other char­ac­ters can be rep­res­en­ted with seven positions and two states (1 and 0). However, since this cannot represent anywhere near all the char­ac­ters in the world, you can also use UTF-8 which uses one to four 8-bit bytes.

Un­der­stand­ing binary coding: how does a computer work?

Computer systems recognise the unit’s bits and bytes. A bit is a position in the code which can be either a 1 or a 0. Its name is a port­manteau of “binary digit”. One byte is eight of these bits. Computers are basically cal­cu­lat­ing machines which work with these units, much like a cal­cu­lat­or. To perform a cal­cu­la­tion, decimal numbers are converted into the binary system.

0 1 2 3 4 5 6 7 8 9
0 1 10 11 100 101 110 111 1000 1001

When thinking in terms of bytes, the decimal number 5 can be rep­res­en­ted as follows: 00000101. The leading zeroes at the beginning of the binary number do not affect the value and only ensure that a fixed format with eight positions is main­tained.

Fact

In ASCII code, the digit 9 is rep­res­en­ted as 0111001 and 0 as 0110000. This is due to the position of the digits in the code table.

As in the decimal system, each position cor­res­ponds to a power. However, unlike in our usual system which uses base 10 for cal­cu­la­tions, the binary system uses base 2. The first position cor­res­ponds to 20, the second to 21, the third to 22 and so forth. A byte cor­res­pond­ing to the decimal number 23 can be read as follows:

27 26 25 24 23 22 21 20
0 0 0 1 0 1 1 1

Thus we have (decimal): 24 + 22 + 21 + 20 = 16 + 4 + 2 + 1 = 23

Cal­cu­la­tions also work in the binary system similarly to the decimal system: 1100 + 1010 = 10110. What happens during the cal­cu­la­tion? For sim­pli­city’s sake, the addition can be struc­tured in the same way as in a written cal­cu­la­tion. You calculate from right to left.

  • 0 + 0 = 0
  • 0 + 1 = 1
  • 1 + 0 = 1
  • 1 + 1 = 0 carry the 1
Summary

These cal­cu­la­tions are standard for computers and are taking place all the time. Whether we are talking about PCs, smart­phones, tablets or cal­cu­lat­ors, our com­mon­place digital tools could not exist without binary code.

Go to Main Menu