Ever wondered what they really are – bits, bytes and binary? Similar in sound, quite different in what they mean, this article introduces you to computers at their core: we take it down to the physical level and more…

## Bit and Bits!

Computers process data differently from human beings. But have you ever wondered how these massive amounts of data are actually stored? Welcome to computers are their core: bits. Ever piece of information, in most current computing systems, whether they be your desktop PC, your mobile or the intelligent screen on your smart fridge, is stored by means of ‘bits’.

The single most granular piece of information a computer can “understand” and process is a bit. But what is a bit? How can we quantify a bit? It is actually very simple. Picture that you have a little piece of metal (of a form which can be magnetized) and a magnet. If you magnetize the piece of metal, we shall call this state magnetized or `1`. If we do not magnetize the piece of metal, or revert a magnetized piece of metal to an demagnetized state, we shall call such demagnetized state `0`.

This is, in essence, what a bit is: a magnetized or demagnetized piece of metal. Thus, it would seem that we cannot store much information in a single bit: only a `0` and a `1` – two possible states. Let’s take eight bits instead and see what we can do with that.

## Byte and Bytes!

When we combine eight bits together, we form a byte. A byte is a human concept, not one which a computer can understand at it cores. Very early computer developers decided to create bytes out of 8 bits. Let’s see how many combinations we can create using eight bits, set to a state of `0` or `1`:

```0000 0000 = 0
0000 0001 = 1
0000 0010 = 2
0000 0011 = 3
...
0000 1000 = 8
0000 1001 = 9
...
0100 0000 = 64
...
1000 0000 = 128
1000 0001 = 129
1000 0010 = 130
...
1111 1111 = 255
```

On the left is the binary number, on the right is the decimal number.

There are exactly `256` possible combinations (`0 to 255`). Even though we only have eight little pieces of metal, and one magnet, we can now store 255 different states by simply magnetizing or demagnetizing any of the eight pieces of metal. Great? Perhaps, but if you consider that a simple PDF file with a few scanned pages can easily be 10 Megabyte (= 10,000,000 bytes or 80,000,000 bits), you could wonder how any computer could handle 80 million little pieces of metal ;)

Still more astonishing is that many people have an Internet connection which is 50 Mbps (Megabit per second) or more. 50 Mbps is 6,250,000 bytes per second which in turn is an astonishing 50,000,000 bits per second. In this case, the data is not stored on magnetized pieces of metal.

The next question that may come to mind is – where are these bits written to? Any form of storage in a computing system. For example, to the main memory chips in your computer, but just as well to a physical disk, for example of the older HDD (Hard Disk Drive) type which had a literal spinning magnetizable disks inside and a little head would move back and forth while the disks were spinning at 5400, 7000 or 10000 rounds per minute and magnetize bits on or off (`1` or `0`).

A computer also has other places it can store information, for example the Level 1 and Level 2 (and where applicable Level 3 etc.) caches inside a CPU (Central Processing Unit). So what are some of the top speeds that computers can actually magnetize and demagnetize bits?

Welcome to the fastest disks in the world: a fast modern NVMe’s (a type of Solid State Drive, which is in turn a successor of the Hard Disk Drive) can achieve a sequential write speed of 7,000 MB/s, that is 56,000,000,000 physical magnetic bit writes per second. Incredible, but real.

It is good sometimes to back track a little into history and how things work to appreciate what has been achieved, and to realize at what incredible rate we are progressing. This is, in reality, what happens inside your computer, every second, and more and faster still, when you are processing an intense workload. Cool?

## Binary!

Now that we have looked at bits and bytes, we can take a little step up and move to Binary. Binary as a term can be used as an indication of a binary number (alike to our single-byte example above where we went from `0000 0000` (0 decimal) to `1111 1111` (255 decimal), or as a flow, some data or a state.

For example, we can talk about a binary flow of data when we are talking about zeros and ones moving across a computer wire. In such a case (a binary flow of data), the state of the bits is not magnetized or demagnetized as when it is stored in a disk or cache, but rather a live voltage (for example +5 Volt) to indicate a state of `1`, and zero Volt to indicate a state of `0`.

We can use the word binary to refer to data stored as binary (for example on a disk), or as a state, for example an executable file on a computer is often labeled a binary. Will all these different uses of binary it takes a little time to get used to the jargon.

## Wrapping Up

In this article we explored the nitty gritty dynamics of what happens at the core of computer: simple bits, magnetized or demagnetized onto disk, or voltage on or off flowing over the wire, are the most basic units of computing and data storage. We then took a step up and moved onto bytes and how a single byte can contain a value from 0 to 255 by setting 8 individual bits on or off. We finally explored binary and the many ways in which the word binary can be used.

Next time at the cafe, tell some of your less versed friends a story about bits and bytes and binary.

Enjoy!

Roel Van de Paar
Roel has 25 years of experience in IT & business, 9 years of leading teams, and 5 years in hiring & building teams. He worked for companies like Oracle, Volvo, Sun, Percona, Siemens, Karat, and now MariaDB in various senior, principal, lead, and managerial roles.