How do computers work?

Computers are nothing but electric circuits.

Let’s start from a simple circuit with a switch. This circuit has two states: if the switch is open no current passes; if it is closed, there is current passing through it. This is called a bit, the simplest unit of information, with two possible values: 0 if open, 1 if closed.

Now let’s combine 8 of these circuits. We now have a sequence of 8 bits, which we call a byte. If we interpret it as a number in base 2, it can take values from 0 to 255. We can combine more bytes to represent larger numbers, and perform operations on them using boolean algebra.

We can then say that every number corresponds to something else such as a character, so for example 00000001 = ‘1’ or 01000000 = ‘a’, and use it to write and store documents. In other contexts, sequences of bytes can become instructions to be executed, the color of a pixel on a screen or a music note.

Once we have all these encodings, we can write software that handles them for us, eliminating the need to deal directly with bits and bytes, and then use that to create more advanced software that makes everything even simpler, such as operating systems and programs.

Every time we add a layer of software our computer becomes easier to use, to the point that even a small kid can do it with little to no training. At the same time, this makes it harder to see what’s really going on, which is billions and billions of circuits switching from open to close and vice versa at incredible speed.