Sometimes it’s easier to explain concepts by breaking them down into smaller pieces. This article will attempt to introduce bits, bytes and hexadecimal notation to the reader without becoming overcomplicated.
Binary and Bits
At their fundamental level, computers use a numeral system whose digits consist of only two possible values. These digits can either be zeros or ones.
This system is known as Binary. It may seem limiting at first, but any number can be represented in Binary. In most cases, you simply need more zeros and ones.
Binary digits have been given the nickname of Bits : a term built from combining the two words “Binary” and “digITS“.
|Decimal Value||Binary Equivalent|
Having ten fingers (or digits) on our hands, humans have made decimal the most popular numeral system in use by modern civilizations. Decimal consists of ten digits that we are all familiar with : 0,1,2,3,4,5,6,7,8 and 9.
A Byte consists of 8 bits and can represent any of 256 different values. Bytes were originally used as a convenient and Human-friendly way to represent text characters rather than having to use Binary.
Ascii (the Amercian Standard Code for Information Interchange) is an old standard of characters that requires 128 values to represent the entire character set. Although this could be accomplished using only 7 bits, later computers often used 8 bits and added their own characters beyond the Ascii characters. This allowed a single byte to represent 256 unique characters.
Binary consists of two numerical digits and is known as base 2. Decimal consists of ten digits and is known as base 10. Hexadecimal contains sixteen digits and is therefore known as Base 16.
Binary uses the zero and one not unlike decimal. Hexadecimal does as well, but is a superset of decimal. This means it uses the same digits as decimal (0,1,2,3,4,5,6,7,8,9) plus six more additional digits : A,B,C,D,E, and F.
The table above contains all the digits of the hexadecimal, decimal and binary numeral systems. The digits that appear in bold are the unique digits for each of their respective systems.
As you can see, the number of binary digits required to match the value of the single hexadecimal digit of A is four. Even our trusty decimal system requires two digits to match hexadecimal digits A to F.
The purpose of hexadecimal is to provide a short hand for binary. You can describe the equivalent value of 4 bits using only a single hexadecimal digit. As a result hexadecimal is more compact. This was quite convenient for programmers of early 4 bit computers.
Another benefit of hex (hexadecimal) is realized when a programmer is faced with sifting through a lot of data. It is easier for the human eye to find a particular hex value than it is to find a matching pattern containing a long string of zeros and ones (binary).
Arguably the most common use of hexadecimal notation today comes in the form of describing color online using what is known as Webhex. We will be releasing an article describing Webhex in the near future. It will help to demonstrate how to use a pair of hexadecimal digits to represent one byte (which may contain up to 3 decimal digits).