Understanding how binary works

NicolasBrondinBernard

Author
@NicolasBrondinBernard

Do you think that sequences of 0s and 1s are incomprehensible? I'm going to explain it all to you!

Article published on 09/04/2021, last updated on 10/08/2026

In electronics, and therefore in computing, information, data, and instructions are transmitted in binary. This is a notation that often frightens the uninitiated, but which becomes very quickly demystified once you understand its purpose and how it works.

I want to point out that, except in a few specific fields, using (reading or writing) binary is not common practice, but it is necessary to know at least the rules that govern how our machines work, and this representation is part of that.

What you need to know

Binary is what is called a numeric "base," that is, a particular notation for representing numbers using different digits, in this case 0 and 1.

As a reminder: 5 is a digit, whereas 195 is a number.

What is a numeric base?

We are used to base 10, we use 10 different digits (from 0 to 9) to represent our numbers and their significance goes from right to left (the rightmost digit of the number represents the smallest value).

In the number 195, the digit 5 represents the smallest value, and the 1 the largest.

To count, we therefore start with a single digit, and when we reach the last available digit, we go back to 0, but we then add a digit to the left of our number, which gives us: 0, 1, 2, ... , 9, 10, 11, 12, ...

This seems logical to us, but there is a mathematical reality behind all of it.

When we count in base 10, we break down a number like 195 as follows:

  • the digit 1 represents the hundreds
  • the digit 9 represents the tens
  • the digit 5 represents the units

But in mathematics, we say that each digit corresponds to a power of the base, in this case a power of 10:

  • the digit 1 represents 1 × 10² = 100
  • the digit 9 represents 9 × 10¹ = 90
  • the digit 5 represents 5 × 10⁰ = 5

If we add all that up, we do indeed get back our number 195

This seems logical for base 10, since the majority of numerical representations in our daily lives are based on it, but why was this base chosen?

The answer is simple: it is biological in nature.

We each have (on average) 10 fingers, on which we can count (in every sense of the term), which is why, over the years, our civilizations started counting in base 10.

But we don't only use that base, we also use base 60 for seconds and minutes, here is an article if you want to know the reasons why.

Why do we use binary?

What you need to remember is that we use a particular numeric base because of a biological, mathematical, or physical constraint, and well, it's the same thing with the binary base!

Binary allows us to overcome a physical limitation: that of representing and storing (in a simple way) a piece of data using an electric current.

By using the presence (or absence) of electric current, we only have two possible values: 0 or 1 (open or closed if we're talking about an electrical circuit).

Representing data in binary

But then how can we represent complex information using simply 0s and 1s?

There are two answers to this question: conventions and multiplicity.

A convention means that there is an agreement between several parties (people, systems, software, etc.) about what should be sent versus what is received.

To the question: "Are you married?", we expect a simple conventional answer (yes or no), but the data conveyed in the end is complex and implies many other things thanks to the convention.

Similarly, if you are asked many binary-answer questions of this kind, you will only have given "true" or "false" (0 or 1) answers, and yet the entirety of your answers to the questionnaire will make up a set of data that is very complex about you.

For binary information circulating within a computer system, it's the same thing!

We might, for example, decide to represent the letters of our alphabet using a defined binary code, and it will just be a matter of putting them one after another to get a complete text!

Example: "a" = 0001, "b" = 0010, "c" = 0011, ...

So if we think about it carefully, a piece of binary data can represent any piece of data in our universe, as long as it follows a convention for its representation, and as long as the length of the binary code is large enough to contain all the information!

If we take our alphabet, we would therefore need to be able to have at least 26 different combinations in binary in order to be able to encode all the letters and transmit them within an electronic system.

Reading and writing binary

As you might expect, a binary "word" looks like a sequence of zeros and ones like this: 0110.

As we saw earlier, a binary word is actually a number written in base 2 (0 and 1), so if we convert it into a base we're comfortable with (base 10), we can turn it into information that is more understandable to us (and less so for machines).

To do this, we just need to use the same technique as for base 10, we're going to break this number down into several digits, we will no longer read 0110 but 0―1―1―0

As with all numeric bases, the increasing order of powers goes from right to left, except here, we use powers of 2:

  • the digit 0 represents 0 × 2³ = 0
  • the digit 1 represents 1 × 2² = 4
  • the digit 1 represents 1 × 2¹ = 2
  • the digit 1 represents 0 × 2 = 0

If we add up 4 + 2, our binary word 0110 is therefore equal to 6!

To make reading (or writing) easier, we can simply make a table where we write out the different powers of 2, let's say the first 10, and all we need to do is add up the digits in the first row each time a 1 is present in our binary word.

Value

1024

512

256

128

64

32

16

8

4

2

1

42

0

0

0

0

0

1

0

1

0

1

0

511

0

0

1

1

1

1

1

1

1

1

1

1024

1

0

0

0

0

0

0

0

0

0

0

Congratulations, you have just converted binary into a decimal number, easier for our brain to read!

You see, it wasn't that complicated, you just need to change the way you look at numbers to see them simply as digits lined up one after another, even if they're only 0s and 1s!


Umberto sur Unsplash

Finished reading this article?
Our newsletter

No spam. Only free content, news, and ever more resources to level up your skills!

Join +1500 developers

Comments (0)

to leave a comment

No comments yet