Number Systems

When we write numbers, we have ten different digits that we can put in each place (0-9). After that we need to add a new column of digits and we keep going. This is called the decimal system (or base 10). What would happen if instead of using ten digits we used eight, or two, or even sixteen? Well, what happens is instead of a decimal system we would have what's called binary, octal, or hexadecimal systems (base 2, base 8, and base 16). We use subscripts to denote the system we are using: 987610 is decimal (if we don't use a subscript we assume we are using decimal), 76538 is octal, 10102 is binary, and BEEF16 is yummy hexadecimal.

Binary – binary just has 1s and 0s. But much of our world is binary. Light switches are either up or down, your computer is either on or off, our servers are either currently up or down (hopefully up). Because computers are made up of billions of little switches (called transistors), they do calculations in binary. Everything in your computer is either on or off. And so we represent larger numbers in 1s and 0s. Each 1 or 0 is called a bit, and 8 bits is a byte.

Octal – at some point we end up with a lot of 1s and 0s and they are kind of hard to read. For example "010101000110100001100101" and that’s just to spell "The.”  But if we break that into 3 piece sections with 8 possible digits it becomes 250641458 which is a little easier to read. And thus we have octal.  Unfortunately for octal we rarely use it.

Hexadecimal – What happens if we break that down into 4 piece sections? Well, first of all we run out of digits because now we have 16 possible digits instead of our normal 10. So the powers that be just decided to start using letters so hexadecimal has 16 digits (0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F). In other words if we wanted to write 1010 we would write A16 etc.  Now if we want to write out the word "the" it looks like 54686516 which is a whole lot easier to read.

Decimal Value Hex Value Binary Value
0 0x00 0000
1 0x01 0001
2 0x02 0010
3 0x03 0011
4 0x04 0100
5 0x05 0101
6 0x06 0110
7 0x07 0111
8 0x08 1000
9 0x09 1001
10 0x0A 1010
11 0x0B 1011
12 0x0C 1100
13 0x0D 1101
14 0x0E 1110
15 0x0F 1111

Conversion – In decimal, the least significant digit (the one on the right) keeps track of 100. The next column is 101, then 102 etc.

So 382 is
(2 x 100)+ (8 x 101) + (3 x 102) = 2 + 80 + 300.

The same is true for other systems.

For example, 1011111102 goes thusly:
(0 x 20) + (1 x 21) + (1 x 22) + (1 x 23) + (1 x 24) + (1 x 25) + (1 x 26) + (0 x 27) + (1 x 28) =
0 + 2 + 4 + 8 + 16 + 32 + 64 + 0 + 256 = 38210

Now you try (highlight for answers):


D x 160 = 13 x 1 = 13
E x 161 = 14 x 16 =224
E x 162 = 14 x 256 =3584
B x 163 = 11 x 4096 =45056

Add that up and you get: 4887710

And remember just because things have bytes does NOT mean you should bite them. None of our products should be ingested or inserted under the skin.

Comments 15 comments

  • Tutorial:

    And remember just because things have bytes does NOT mean you should bite them. None of our products should be ingested or inserted under the skin.
    Not even .......??

  • i thought electronic electronic engineering was advanced some parts of this simple some not.

  • Remember ONE "BEEF" -base hex is four Bytes, or eight Nibbles, or 16 bits. And a Googolplex is a number that's just perplexing x 10^(10^100). Sorry, I just had to throught that out there.

  • haha, if theres a quiz question on this i fully expect all of the answers to be wrong since theres been so many errors pointed out

  • Ouch -- 4096 people, 4096! Not 4094!

  • This is probably the best introduction to binary, hexadecimal, and octal number systems that I have ever read. I had decimal and binary down, but I just couldn't understand how hex or oct worked. You guys rock.
    Now I'll probably keep getting Christmas confused with Halloween. (DEC 25 = OCT 31)

  • Unfortunately there's still an error in the example above. 16^3 is 4096, not 4094.
    If you multiply 11 times 4094, you get 45034. Add the totals up and you get 48855 in decimal which is BED7 in hex.

  • M-Short, I believe you meant Numeral Systems instead of Number Systems for the title of this tutorial.

  • 2^12 = 4096 :)

  • Sorry about that, I changed the example question from BEEF to BEED and missed the answer (that's what happens when you have white text). It is now fixed

  • Note 0x546865 spells "The" with capital "T" 0x746865 spells "the"

  • There is a slight error in the "Now You Try" section. The hexadecimal you show (BEED) is actually equal to decimal 48877. I think you meant to have the hexadecimal of BEEF which does equal the decimal 48879 in your answer.
    Maybe that was part of the test?

  • @SuCom
    I imagine that product is the reason for that comment.

  • 48,879 doesn't sound as beefy :(