What is a Byte anyway?

Introduction

We all use technology on a regular basis and we know that our electronic computing technology is based on bytes. But what exactly is a ‘Byte’ and why does it matter so much?

Disclaimers

I am independent from the organisations listed above and am in no way writing for or endorsed by them.

References

Additional disclaimer

The information presented in this article is written according to my own understanding, there could be technical inaccuracies, so please do undertake your own research.

A byte

Because computers are electronic circuits, they are built using ‘transistors’, if you combine two transistors together in a circuit then you can create a ‘Flip-flop’ which can retain / store one of two states (Flip-flops can also be created from ‘Valves’ / ‘Vacuum Tubes’). Thus you can have a ‘bit’ where the state of the ‘flip-flop’ can be ‘on’ or ‘off’, thus ‘0’ or ‘1’. As we have only two states then we are operating in ‘Base-2’ or ‘Binary’ instead of ‘Base-10’ or ‘Decimal’ where there are ten states, being 0 to 9.

If we combine several bits together, say four, then we get a ‘Nibble’ and can represent a number between 0 and 15, i.e. 8 + 4 + 2 + 1 = 15. Combine two ‘Nibbles’ together and we get a ‘Byte’ containing eight ‘bits’ and able to represent a number between 0 and 255, i.e. 128 + 64 + 32 + 16 + 8 + 4 + 2 + 1 = 255. Where the added up numbers represent the positional value of a bit, just like in decimal where we have the ones, tens, hundreds… columns. Thus there are ‘two nibbles in a byte’. But there is also ‘Base-16’ or ‘Hexadecimal’ where there are sixteen states, represented by 0 to 9, then A to F for the decimal numbers 0 to 15. But hang on! 15! That’s the maximum value that can be stored in a nibble! And that’s the point, so instead of having to type out ‘11010011’ to represent the decimal number 211, we can simply type ‘D3’. Therefore we can describe this like so:

A byte

Now that we can understand that a Byte stores a number and in principle that an electric circuit can be created to have a ‘byte’ that retains a number for us, then we have one of the building blocks of a computer that can use the value stored or ‘data’. But its just ‘data’, it has no meaning unless we attribute one to it to give it purpose so that it becomes ‘information’. And data can represent lots of different types of information, and critically, one type of information is an ‘instruction’ to do something.

Instructions and storage

Bytes are stored in memory or storage devices such as a hard disk drive. They are arranged one after another and indexed or ‘addressed’ using binary. Thus, you can have a byte in one location that represents an ‘instruction’, such as ‘add’ and then the next two bytes represent the numbers to add. Where the instruction ‘A4’ means to add the numbers ‘22’ and ‘20’ together and store in the next addressed byte, therefore we can show this as:

Example CPU instruction and data

Note: I have just made this up and it does not represent a CPU that I know of.

The ‘binary’ form of the instruction ‘A4’ which is ‘10100100’, being a set of ‘switch states’ that tell the CPU to establish a certain circuit path within itself to perform the ‘Add’ with the data it will fetch and store in its ‘registers’ from memory.

You can read more about this area in my article ‘Interpretation of Data’, where this article is really a pre-cursor to it and could aid as an addition to understanding it.

Other interpretations

Now that we’ve seen what a byte is and how the value it stores called ‘data’ is interpreted into ‘information’, then what about a real world example?

We all view web pages all the time, but what is that ‘data’ and its structure? If we use a ‘Packet sniffer’ such as ‘Wireshark’, then we can look at the contents of the data going across our network interfaces and understand it (as long as its not encrypted, such as with HTTPS), then we can see the request to get the ‘Moodle’ logo in the footer in the Boost theme:

Fetching the Moodle logo over a network, shown by Wireshark.

Where I’ve highlighted in the sequence of bytes, the Internet Protocol version 4 (IPv4) address of the machine requesting the image, here being ‘192.168.1.99’ or ‘C0 A8 01 63’. You can also see lots of other data that is interpreted and structured in different ways, such as the TCP portion of the message containing the destination port ‘80’ that your web server will typically ‘listen to’ so that it can serve web pages. If you want to see how the information is encrypted with HTTPS, have a go at running Wireshark and look at the interactions you make with a HTTPS Moodle site.

Images themselves, as we have just requested (the ‘moodlelogo_greyhat’ SVG image) have their own structure too. In this case SVG – en.wikipedia.org/wiki/Scalable_Vector_Graphics, with is extended from XML – en.wikipedia.org/wiki/XML – which is text (I won’t go any further, but please do if you wish). But there are others that I’m sure your are familiar with such as JPEG and PNG files that you can see explained on en.wikipedia.org/wiki/JPEG#Syntax_and_structure and en.wikipedia.org/wiki/Portable_Network_Graphics#File_format.

And so on, bytes are interpreted in so many different ways to solve the problems that we want technology to do for us.

Conclusion

The world is made up of data, but what matters is how we interpret that data and derive the information we understand from it.

What do you think? Please let me know in the comments.

Gareth Barnard
Latest posts by Gareth Barnard (see all)
blank

Gareth Barnard

Gareth is a developer of numerous Moodle Themes including Essential (the most popular Moodle Theme ever), Shoelace, and other modules such as course formats.

One thought on “What is a Byte anyway?

  • 16th April 2021 at 12:33 pm
    Permalink

    Awesome post Gareth – I learned a few things myself !
    I’ve tried Wireshark, but it felt pretty overwhelming to a “semi techie” like myself.
    I might have to look again !

    Reply

Add a reply or comment...

%d bloggers like this: