dacs.doc electric

 

Converting Hexadecimal to Binary

By April Miller Cripliver
MCSE, MCP+I, MCT, A+

 

The decimal, hexadecimal, and binary numbering systems all start with zero. Our habit is to think of the "first" of something as being Number 1, but in the world of computers and technology, you'll need to become accustomed to that first thing being number 0.

If you remember your elementary school math, the number of digits that can fit into the units (ones) column is called the base. Decimal comes from the Latin "ten" and allows 10 digits in the ones column (0-9). Decimal numbering is also called base-10. When you have more than 10 digits, you cross over to the tens column.

In regular counting, we would start with a one and go to a nine. When we added one more number, we would put a zero in the ones column, and a one in the tens column, making a 10. In computer math, we start with zero. When we get to the end of the allowed numbers in the ones column, we go back to the beginning, put down a zero, and move a one to the tens column.

Binary refers to base-2 numbers, in that there are only two units before you begin using the tens column. In base-2 numbering, you can only have a zero and a one in the ones column. There is no two, and you have to go to the tens column instead. One moves to the left of the zero after two digits, just as one moves to the left of zero after 10 digits in base-10 numbers (decimal).

There's actually no 10 symbol in decimal numbering either. The word we use to describe a one in the tens column and a zero in the ones column is ten. Ten is the same word in any base numbering, but we get to that 10 by more or fewer numbers in the ones column. In base-3 numbers, we would count zero, one, two, ten.

Text counting in binary would be: zero, one, ten, eleven, one hundred, one hundred and one, one hundred and ten, one hundred and eleven, and one thousand. The same sequence in symbols would be 0, 1, 10, 11, 100, 101, 110, 111, and 1000, respectively. Because binary has only ones and zeros, there's no such thing as a two. The two is replaced by what we think of as a 10.

The largest eight-bit number is 11111111, which is made up of eight "ones," and converts a 255 in decimal. By amazing coincidence, the last character in the ASCII keyboard character translation table is 255-a blank space. On the other hand, decimal/binary zero is also a space, so maybe it's not that incredible.

Hexadecimal (hex) is base-16 numbering, where numbers in the ones column must go beyond 10 digits all the way to 16 digits. This requires the use of letters, since decimal numbering (base-10) has only 10 available digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, before making a 10. Hexadecimal (often abbreviated as Hex, H, or h) adds A, B, C, D. E, and F.

Counting a full sequence would be 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, and F. The F represents the "tens" column crossover point, just like the nine does in decimal numbers. In this case, 15 (the F) is the sixteenth digit and the last that can fit in the ones column. Don't forget that zero was the first digit.

Following F (in base-16) would come a "tens unit," so the next number is 10. The sequence continues as 11, 12, 13, 14, 15, 16, 17, 18, 19, 1A, 1B, 1C, 1D, 1E, 1F, and then another tens unit, making 20.

Hexadecimal numbering allows for cramming more information into a smaller space. For example, the decimal 255 (three digits) becomes FFh (two bits) in Hex. The small "h" following the number ensures that the reader realizes the number is in base-16 (hex).


April Miller holds several certifications and degrees in in business and computer science. She is a trainer and computer consultant in Indiana. April welcomes e-mail from readers at april@cripliver.com.

BackHomeNext