S0C13TY

There's Something About Binary

How does binary work?

Computers are essentially built out of on/off switches (electricity in a wire is either "On" = 1 or "Off" = 0). Each of these binary switches is known as a "bit" and if you stick them together you can represent bigger numbers.

e.g. with 2 switches you can count 4 things (if you consider 0 to be a number):

Bit 2Bit 1  
 0=0
 1=1
10=2
11=3

Add another switch and you can count up to 8 things (7 + "0")

Bit 3Bit 2Bit 1  
100=4
101=5
110=6
111=7

etc, etc.

Bytes

Computers generally cluster bits together into "bytes" - an 8bit computer has bytes representing numbers up to 256, but a 16bit machine can handle numbers up to 65,536 and so on.

If you have an 8 bit computer "just" counting up to 200 would be a waste of space, so that's why most figures you read around computer science utilise all the switches, i.e. are multiples of 2: "256" or "512" or "1024" etc

Hex

Writing binary out long-hand is crap, so hexadecimal was created as a shorthand.

Binary Table

Here are the first 256, 8 bit binary numbers:

0123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255
00000000000000010000000100000011000000010000010100000011000001110000000100001001000001010000110100000011000010110000011100001111000000010001000100001001000110010000010100010101000011010001110100000011000100110000101100011011000001110001011100001111000111110000000100100001000100010011000100001001001010010001100100111001000001010010010100010101001101010000110100101101000111010011110100000011001000110001001100110011000010110010101100011011001110110000011100100111000101110011011100001111001011110001111100111111000000010100000100100001011000010001000101010001001100010111000100001001010010010010100101101001000110010101100100111001011110010000010101000101001001010110010100010101010101010011010101110101000011010100110100101101011011010001110101011101001111010111110100000011010000110010001101100011000100110101001100110011011100110000101101001011001010110110101100011011010110110011101101111011000001110100011100100111011001110001011101010111001101110111011100001111010011110010111101101111000111110101111100111111011111110000000110000001010000011100000100100001101000010110000111100001000100011001000101010001110100010011000110110001011100011111000100001001100010010100100111001001001010011010100101101001111010010001100110011001010110011101100100111001101110010111100111111001000001011000010101000101110001010010010110100101011001011110010100010101100101010101010111010101001101011011010101110101111101010000110110001101010011011100110100101101101011010110110111101101000111011001110101011101110111010011110110111101011111011111110100000011100000110100001111000011001000111010001101100011111000110001001110010011010100111101001100110011101100110111001111110011000010111000101101001011110010110010101110101011011010111110101100011011100110110101101111011011001110111011101101111011111110110000011110000111010001111100011100100111101001110110011111100111000101111001011101010111110101110011011110110111011101111111011100001111100011110100111111001111001011111010111101101111111011110001111110011111010111111101111100111111101111110111111111111111