Sitemap

Binary, Hex, and the 8-bit byte

5 min readMar 23, 2026

--

Ever wondered why your scientific calculator has the letters A through F? or why 1KB = 1024B? I mean, what is wrong with it being equal to 1000? It’s cleaner, right? Or seen colors written as #FF8040? (what does that even have to do with color?)
We are about to learn a very interesting lesson that is core to all computer systems. Notation and the 8-bit byte!

First, we start at the most basic level. We all now know that machines operate and understand the simple language of bits of 0s and 1s, something we like to call, binary. This is the most basic part of any machine. This stems from the hardware being binary. The hardware these machines run on, say, a transistor, has 2 states (it's either conducting electricity or not). Even when storing, communicating, processing, displaying, anything a machine does is all done in these bits. Writing these bits and how they’re organized is the binary notation! The most fundamental notation for a machine.

In our day-to-day lives, we are more of a decimal notation world. It is the most basic and natural to us. You can effortlessly count from 1 to 100 and so on. This is using the decimal notation. It is very unnatural and would be an uphill task for any of us to comfortably recite numbers from 1 to 100 in binary. Counting from 0 to 5 in binary would look like: 0000, 0001, 0010, 0011, 0100, 0101. That is not so interesting, or easy!

We have so far introduced 2 notations. One basic to us, and the other basic to the machine.
A machine-level program views memory as a very large array of bytes.
So we have our decimal notation that we have to convert to binary, which can be tedious for any programmer. And the machine uses binary that is just too verbose. I mean, look at what counting to 5 looked like!
(you might wonder why a programmer might want to do this transition quickly on their end when there are high-level languages to program in, but for the most basic parts of a machine, being able to understand how the machine receives and understands the instructions given is very crucial. Programming existed before the introduction of high-level languages.)

To use an example of a computer in action, I’ll use the function of accessing memory. When accessing memory, a computer just has to access these bits of 0s and 1s and read them. Reading each bit individually is not practical. Hence, most computers use blocks of 8 bits as the smallest addressable unit of memory because they’re faster, more reliable, and align with hardware design.
And therefore, 1 byte = 8 bits.
In binary notation, its value ranges from 00000000 (base 2) to 11111111(base 2). (counting from 00000000, 00000001, 00000010, e.t.c).
If you convert that range to decimal integers, the range is 0 to 255.
Looking at the above, none of these basic notations are convenient to describe bit patterns.

A middle ground had to be obtained. Something that was convenient to describe bit patterns. A notation to convert to binary. Not too hard for the programmer to read and interpret into binary, and yet still, not hard to write or verbose.
This is where the hexadecimal notation was adopted.
Hexadecimal (or hex, as we shall call it from here on) is just base 16.
Hex uses digits ‘0’ through ‘9’ along with characters ‘A’ through ‘F’ to represent 16 possible values.
Before learning how this conversion is calculated, we can look at what our byte range will look like in hex. Written in hexadecimal, the value of a single byte can range from 00(base 16) to FF(base 16)

Get LeslieAine’s stories in your inbox

Join Medium for free to get updates from this writer.

The chart below gives a simple map of the values used in hex and their corresponding values in binary and decimal notations.

Press enter or click to view image in full size
Hexadecimal notation. Each hex digit encodes one of 16 values. Screenshot from CS:APP

As you can see, you can convert between binary and hex easily without doing long and hard math. Every 4-bit chunk becomes one hex digit. That makes hex compact enough for humans to handle, but still directly translatable to the binary that machines actually use.
Hex is usually represented by the prefix 0x… So a number as FA1D37B(base 16) can be written as 0xFA1D37B16 to represent that it is in hex. You probably have seen Ethereum addresses written in such a way, say, 0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045. Yes, that is hex!
And that is why you have those letters A to F on your calculator and not exceeding that. Hex is a useful notation in mathematics and computing, and your calculator is there to incorporate it for you as a mathematician or programmer.

So we have looked at the idea of notation and how useful it is in the computing field where numbers and characters can be confusing to use. Even moreso that machines operate with a notation that is not very natural to our reading and writing.

It is from this same idea of the 8-bit byte and its notations being used in separate ways where we might see patterns that we are familiar with, and possibly even questioned at some point. Some patterns from this idea might look like this:

  1. Memory addressing. This one of the questions we started with. why 1KB= 1024B and not 1000? With the 8-bit byte as the fundamental unit, when you address memory, you’re often dealing with multiples of bytes but there is an addition to account for the fact our systems are binary and will work smoothly with powers of 2 as they’re ‘round’ in binary arithmetic. So you end up having a kilobyte looking like;
    1KB = 2¹⁰ = 1024B and not just 1000!
    You have your traditional hard drive storing in the same multiples and powers of 2. There is a reason 256, 512 appear a lot when dealing with storage. It is a cascading pattern that will look like;
    8 bits (as we discussed memory is addressed in 8 bits) = 1 byte (2³) and so values per byte = (2⁸) = 256 values and then we have systems adopt 512 which is just a multiple of 256.
  2. Color representation: In standard RGB color, each color channel uses 8 bits, giving you 256 possible values (0–255) per channel. That would mean that the red channel uses 8 bits, thus, 256 possibilities. The green channel uses 8 bits, thus, 256 possibilities. The blue channel uses 8 bits, thus, 256 possibilities, which would give you a total of :
    256 × 256 × 256 = 16.7 million colors.
    So when you see a color written as RGB(255, 128, 64), it means that it is full red (255), half green (128), half blue (64), and this same color can be written in hex as #FF8040. And that is why those numbers do not go beyond 255.
  3. Network protocols: IPv4 addresses use 4 bytes (32 bits total), with each octet ranging 0–255. Hence you see something like, 192.168.1.255. That is the range and it again because of this 8 bit byte idea.

There is a lot of practical examples and usage of this system as it is fundamental to the working of most machines. You can search this and find out for yourself all the interesting ways you have been using binary and how these 8 bits have been affecting your daily life.

--

--

LeslieAine
LeslieAine

Written by LeslieAine

I love reading, coding and writing. If I am not doing these, I am probably watching a very amusing series, or grappling. Or resting... The list is endless.