Binary and Hexadecimal

Updated: Sep 20, 2026

The Binary System is the heart of communication with computers, networks and electronics in general.

This can often be a difficult concept to understand. Hopefully, I can teach you in a way that makes it easy.

But first, I need to get you to throw away most of what you have learned and think you know.

This might be a bit hard. For most of our lives, we have only known and used the decimal system.

For most of us, the decimal system was drilled into our heads through memorization and repetition. I need you to try to forget all that for now.

So let's start.

Numbers are not real. Numbers are an abstract concept we can't touch. A 5 is only the visual representation of five things.

Let me illustrate this to you.

If I said I have five dollars, you might assume I have a five dollar bill. But I could have five one dollar bills. Or, I could have twenty quarters. Or any number of combinations.

You see numbers are the conceptual value of something. They express a condition or a state.

Let's talk about another example.

Say I have five apples. Visually you can see that there are five apples. What if I gave the value of red apples as one and the value of green apples as two.

The information that we have changes.

If I have four red apples and one green apple, the total value of my apples becomes six.

If I have three red apples and two green apples, the value of my apples now becomes seven.

If I then go on to say bananas are three and oranges are four, we start to establish a method of symbolically representing value.

Like red apples and green apples, we use symbols to communicate information and ideas. These symbols are not called numbers they are called numerals.

The numerals we most commonly use are the arabic numerals. We call these numerals and the numbers they represent by the same name. 0, 1, 2, 3, 4, 5, 6, 7, 8, and 9

It is totally OK if you call numerals, numbers, but it's important to know numerals are the symbols we use.

Arabic Numerals are not the only way to represent numbers.

We also have roman numerals consisting of the symbols I, V, X, L, C, D, and M.

But we also have other ways to represent numbers.

We have the dot notation we often see on a six sided die. Or, tally notation where we group lines in to blocks of five.

The point is they are symbolic representations.

Computers don't understand our symbols. They only know two conditional states. On or Off. Postive or Negative. High or Low. True or False. Zero or One.

In this context, our familiar decimal system uses ten symbols. Whereas, binary only uses two. We call this the base. Base10 means there are ten symbols. Base2 means there are two. There are any number of bases. Using eight symbols would be Base8 also call the octal system. Using sixteen symbols is Base16 and is called hexadecimal.

While my focus here is on Base2, the binary system, I'll also cover Base16. But do know in computing we often use other bases like base8 and base64.

Now that we've explained that numbers are not numerals; that numerals are the symbols we use; and the number of symbols we use in a system is called its base. Let's relearn how to count.

While this may not be what we were taught, conventionally we always start from zero.

Using Base10 we have:

 0 = zero
 1 = one
 2 = two
 3 = three
 4 = four
 5 = five
 6 = six
 7 = seven
 8 = eight
 9 = nine

At nine, we have run out of symbols. To solve this we use what is called positional notation.

In positional notation, we add a new symbol to the left and start over again in the right column at zero.

So

 10 = ten
 11 = eleven
 12 = twelve
 (...)
 19

When we get to 19, we increment our left side numeral and start over again at zero on the right.

So

 20 = twenty
 21 = twenty-one
 22 = twenty-two
 (...) and so on

This pattern continues until we get to 99 = ninety-nine when are force again to add a symbol to the left to get to 100 = one hundred.

Binary works exactly the same way. But we are limited to only two symbols. 0 and 1

Counting binary works this way.

Starting at zero

 0 = zero
 1 = one

But now we are out of symbols, again using positional notation we add a symbol to the left

 10 = two
 11 = three

Add a symbol to the left and continue.

 100 = four
 101 = five
 110 = six
 111 = seven

In hexadecimal, or Base16, we have sixteen symbols. 0,1,2,3,4,5,6,7,8,9,a,b,c,d,e, and f. We use the letters a,b,c,d,e, and f to increase our numeral set primarily because we already have these symbols on our keyboards. It also doesn't matter if we use a lower case or upper case letter. We assume the a or A represents the same value of ten.

Counting in hexadecimal looks like this:

 0 = zero
 1 = one
 2 = two
 3 = three
 4 = four
 5 = five
 6 = six
 7 = seven
 8 = eight
 9 = nine
 A = ten
 B = eleven
 C = twelve
 D = thirteen
 E = fourteen
 F = fifteen

Now that we have run out of symbols we use positional notation again

 10 = sixteen
 11 = seventeen
 12 = eighteen

The pattern in hexadecimal continues just like decimal and binary with FF, two hundred and fifty-five(255), being the largest number we can represent in just 2 positions.

In computers our numerical representation is often constrained to a fixed length or a maximum number of positions. In decimal we call each of these positions a digit. So a three digit number might be 314 or 782. In binary, this is called a Binary Digit. We call it bit for short. In hexadecimal it's called, you guessed it, a Hexadecimal Digit. We often just say hex for short. More often phrased like 2 digit hex or 6 digit hex.

When we have a grouping of eight binary digits, 8 bits, we call this a byte.

At this point you hopefully understand positional notation and when we talk about base we are talking about the number of symbols we are using to represent a value.

With this understanding, if we were presented with 8 bits in binary that looks like 10101010 or was presented 2 digits in hex like AA, we could start counting to determine their value in decimal. But, there is a faster and easier way using the fundamentals of mathematics we may not even recognize.

Let's go back to understanding the decimal system.

If we have a 2 digit number in base10. We can organize the numerical symbols in 100 different ways. If we started counting at 0 we'd end at 99.

If we have a 3 digit number in base10. We can organize the numerical symbols in 1000 different ways. If we started counting at 0 we'd end at 999.

Let's explore this a little deeper and understand what our positions are telling us. Each time we increase the number of positions, the largest representative number is increased exponentially.

The mathematical formula for maximum number of combinations is the base, 10, to the power of positions. Or 10^3. Knowing that we always start from zero and 1000 is four digits not three. Our biggest number, mathematically is:

 (10^3) - 1 = 1000 - 1 = 999    From 000 to 999

These same rules apply to binary. If we have a base of 2 and 8 positions, that formula would be:

 (2^8) - 1 = 256 - 1 = 255      From 00000000 to 11111111

Same for hex

 (16^2) - 1 = 256 - 1 = 255      From 00 to FF

Since we know we are using exponents, what else can we learn about our numerical representation.

Let's take the number 431

Here we have a 1 in position one, a 3 in position two and a 4 in position three.

Another way to phrase this would be we have a 1 in the 1 position, a 3 in the 10 position, and a 4 in the 100 position.

Let's break that apart and write it this way

  4  | 3  | 1
 --------------
 100 | 10 | 1

Without realizing we are doing a simple math formula that looks like:

 (4 x 100) + (3 x 10) + ( 1 x 1) = 431

So let's write this again like this

  4  | 3  | 1
 --------------
 100 | 10 | 1
 --------------
 400 + 30 + 1    =    431

How do we know the value of each position? It looks like this. Again, keeping in mind we always start from zero.

  The value of Position One   = 10^0 = 1
  The value of Position Two   = 10^1 = 10
  The value of Position Three = 10^2 = 100

Now that we know these mathematical rules when look at our 8 bit or 8 position number in binary 10101010. We can break it down like this:

  The value of Position One   = 2^0 = 1
  The value of Position Two   = 2^1 = 2
  The value of Position Three = 2^2 = 4
  The value of Position Four  = 2^3 = 8
  The value of Position Five  = 2^4 = 16
  The value of Position Six   = 2^5 = 32
  The value of Position Seven = 2^6 = 64
  The value of Position Eight = 2^7 = 128

Let's take our binary example 10101010 and write in this way

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

We can then do multiplications and additions to get our decimal number.

 (1 x 128) + (0 x 64) + (1 x 32) + (0 x 16) + (1 x 8) + (0 x 4) + (1 x 2) + (0 x 1)
Let's write that again like this:
   1 |  0 |  1 |  0 | 1 | 0 | 1 | 0
 ----------------------------------
 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1
 ----------------------------------
 128 +  0 + 32 +  0 + 8 + 0 + 2 + 0  = 170 = 10101010

We can do the same thing for our hex example of AA. Keeping in mind A=10, B=11, C=12, D=13, E=14, F=15

The Value of Position One = 16^0 = 1 The Value of Position Two = 16^1 = 16

  A(10) | A(10)
 ---------------
    16  |    1
 ---------------
   160  +   10    = 170 = AA

Now, you should be able to convert from Binary or Hex or any other base into decimal without too much effort.

In later lessons, when we discuss IP Addresses, MAC Addresses, File Permissions and the like, you will see how we use these conversions on a regular basis.

A couple of closing notes

While computers only understand binary, writing a binary number like 10101010 is often very cumbersome. We will often resort to using hexadecimal. Two hexadecimal digits is equivalent to 1 byte in binary. In computers, you'll often see something like fc:a1:83:72:32:7a which is 6 bytes represented as hexadecimal which is sometimes easier for humans than 11111100 10100001 10000011 01110010 00110010 01111010 but sometimes it may be represented in decimal like 252.161.131.114.050.122. They are the same thing represented differently. Try not to get too confused. When humans interact with computers, we often use different notation bases. In time you'll learn when and how.

Additionally, while many of us have learned the metric system which is rooted in Base10, Base10 doesn't work neatly in a Base2 world. In binary, we'll use the closest approximation.

Meaning, a kilo in metric is 1000 times 10^3, a kilo in binary is 1024 times 2^10. mega in metric is 10^6 or 1,000,000 times in binary it's 2^20 or 1,048,576 times. Officially, the International Electrotechical Commission (IEC) has tried to clear up this confusion by using kibi- instead of kilo- and mebi- instead of mega- yet that isn't always the case.

I think it's unfortunate that most of can only think in Base10. In many uses I think Base8, Base12 or Base16 are superior to Base10. Especially, when we are dealing with circles, angles and time. There is a reason we use eleven and tweleve and not one-teen and two-teen to represent 11 and 12 and a gross is 12x12. It makes more sense mathematically, but it would probably take a couple of centuries to break the Base10 mindset.