Binary in a pretty low number of minutes
I wanted to learn binary a while ago, and I found a lot of tutorials, but many of them werenít complete, or had bugs in them. Thatís why I decided to write this tutorial. (After I found the correct way of course
). Also, I know that there are many tutorials out on the web that are correct, but I still felt like writing my own. For those of you that donít know what binary is, here is part of
the definition from www.dictionary.com:
1. Characterized by or consisting of two parts or components; twofold.
2. Of or relating to a system of numeration having 2 as its base.
Yes, there were 3, 4, and 5 as well, but they had nothing to do with the ďmachine codeĒ binary, so I took them out. So, what is binary? Binary is a base 2 numbering system (Unlike normal numbering for most countries (which is base 10)). It is shown in sets of oneís and zeroís, and each set is 8 characters long. I hope that I havenít lost you too much already
Well, there really isnít too much to do beforehand. I guess that you could either open up a text editor or get a piece of paper and a big fat pencilÖbut thatís up to you. Also, you should know what the ASCII table
is, and how to read it. By read, I do not mean memorize (Unless you are very bored), nor do I mean know why it works. I'll tell you that it is set up like that because whoever made computers figured that that was the easiest way to convert a letter/number/symbol to its decimal equivalent.
. . . . .
Step one: Write the word(s) to be converted
In this step, you will need to write/type the sentences that will later be converted to binary. Truthfully, they donít have to be sentences; there can also be numbers etc. in the sentences. This step is pretty much pointless for me to write, because of how obvious it is
. I put it here just in case someone doesn't know. The one thing that you may want to remember when writing/typing the words is that you may want to leave some room under and to the sides of each letter. You are going to be doing some mathematical work, and you will need room to do it.
Step two: Look it up on the ASCII table
Now this shouldnít really be very tricky. All that you need to do in this step is go to www.asciitable.com
. Now, as stated above in the intro section, you should know how to read this, BUT, for those of you who donít like to read the intro section, Iíll tell you anyway. On the ASCII table, there are five columns per character. For binary, the only ones that you need to know/worry about are the ones labeled 'Dec' and 'Chr'. If you couldnít guess what those are, they are 'decimal' and 'character'. Now here comes the (not so) hard part: Look up every character that you wrote down and find its decimal number. Yeah, that's it. So, if I had a word that I wanted to convert, say it was 'And', then I would look up a capital 'A', and a lowercase 'n' and 'd'. Then you should write those numbers down. (By the way, yes, it does matter if it is capital or lowercase, because they are different decimal values) I usually do it like this:
Step three: Start the actual conversion
Now comes the fun part. The easiest way to think of this conversion is in binary, a 1 is on, and a 0 is off. So if I use the words on or off, you know which is which
In binary, as was said above, it is base two. So you are using only two numbers; one and two. You will also want to know the following numbers:
128, 64, 32, 16, 8, 4, 2, and 1
And you should memorize them in that order. All that is (if turned backwards) is the number doubled every time (1+1 = 2, 2+2 = 4 and so on) Now the reason that we looked up the decimal value of the letters on the ASCII table might be coming into view. We need to, by only using the numbers given above added together, get the decimal value of the letter. I may be confusing you, and this is better explained with an example. We are going to convert the 'A':
We already found the decimal equivalent of 'A' (65). Using only the numbers above, how can we get 65 (Always using the largest number possible, and NEVER using the same number twice in one character)? Well, 64 and 1 are both up there, and added together they equal 65, so that's it! 64 and 1. Now we come back to the on/off thing. Any number that was used is now considered 'on', and everything else is off. But a computer canít read the word on or off; it can only read a 1 or a 0. Therefore we must go through and see which are on or off (well, we already know, but this is another example):
128 64 32 16 8 4 2 1
off on off off off off off on
0 1 0 0 0 0 0 1
Now we put it all together and get: 01000001. So in binary, a capital 'A' is 01000001. Now lets get the rest of the word 'And'
110 (decimal value from ASCII table)
64 + 32 + 8 + 4 + 2 = 110 (added numbers from base2)
128 64 32 16 8 4 2 1
0 1 1 0 1 1 1 0 (on or off)
01101110 (binary equivalent of n)
And for the d:
100 (decimal value from ASCII table)
64 + 32+ 4 = 100 (added numbers from base2)
128 64 32 16 8 4 2 1
0 1 1 0 0 1 0 0 (on or off)
01100100 (binary equivalent of d)
Now put it all together and you get: And = 010000010110111001100100
That's it!! That's how you do binary!
-All binary characters will ALWAYS be 8 characters in length. Do NOT take off any characters at either end (front or back), even if they are a 0
-When using a number, you still have to look it up on the ASCII table. Just because it is a number doesn't mean you can convert it how it is!
If you find any mistakes, or have any suggestions/comments/etc., please post them here. Thanks a lot!