Hi welcome to this CertificationKits CCNAtraining video on binary and hexadecimal number conversion. You are going to need to know the basics of binary and hexadecimal numbering for the CCNA as well as converting between binary and hex. We are going to first talk about binary, which is a base 2 numbering system. How to convert between decimal and binary numbers and back and forth. Hexadecimal numbering we’ll talk about next which is base 16, as well as decimal to hex conversion and from hex back to decimal. Then we’re going to go in and talk about converting directly from binary to hexadecimal or from hexadecimal directly to binary. Let’s go in and take a look at the binary numbering.

Here is my binary numbering system CCNA slide packed full of information here. Base 2, what does that mean? It means that each area or each space is a representation of 2 to something meaning 2 to the 0 would be our first binary space and that has a value of 1. Anything to the 0 has a value of 1. Don't ask me why. 2 to the 1 is 2. So anything in this binary space would be a value of 2 and in binary we have two options: a 1 or a 0, meaning on or off. You either have the value of 1 or you don't have the value of 1. We’re working in a octet here, 8 binary spaces because IP is set up that way. It has got 4 octets, 4, 8 binary space sets. So what we’re looking at, when we’re talking about conversion here is the values we would see in the octet. We’d have 1, 2, 4, 8, 16, 32, 64 and 128. Here is a binary number: 0, 11, 011, 01 and what I want to do is look at what we would do to convert this from this binary number to the decimal value. And what we do is we look at this and we see that 128, the value of 128 here is turned off. That means we don't have a value of 128. 64 and 32 are turned on so what we do is we just start adding the values that we do have: 64 and 32. 16 is not on so we don't add the 16. 8 is on so we add 8. 4 is turned on so we add 4. 2 is not, 1 is turned on so we add the 1. So basically, wherever you have a value turned on within the octet, a 1 is telling you it’s turned on. You take those values and you add them up. 64 and 32 is 96 plus 8, 104, plus 4, 108, plus 1, 109. So 0, 11, 011, 01 equals 109 assuming my math is correct. If I want to check it, I can open up the calculator and take a look at it that way.

If I could type I could open it up much faster. So I just type in calc to open up the calculator. So what we do is we look at our binary numbering system here. I’ll select binary and I’ll go 0, 11, you don't have to put the leading zeros so I just got rid of that. 0, 11, 01 and all I have to do to convert it with the calculator is hit decimal and I can see that the decimal value is 109. So again, all the calculator did for me was added 64, 32, 8, 4 and 1 together to come up with the value of 109. What I want to do now is I am going to bring up a slide with some practice questions and we’ll take a look at these and then we’ll work through them.

Here is some binary practice problems. We are going to be converting binary to decimal.  If it’s a binary value to decimal. I think we’ll be able to tell the difference because the ones I put in binary values are a bunch of zeros and some ones. So this would be an example of a binary value. 56,  Can't have that in binary so we know that that’s a decimal value. What I want you to do is I want you to take a look at this slide and pause it, pause the video for a few minutes and work through these problems. Then turn the CCNA video back on and we will go over them. I am going to do this one first so you could see what we’re doing and then you could go ahead and pause the CCNA video and work through them yourself. Very important to have this down.

So the first one is 56. And how I do that is I will convert 56 to binary by using this number line down here. Here is my values; again 2 to the 0 is 1, 2 to the 1 is 2, 2 to the 2, 2 to the 3, 2 to the 4, so here is the base 2 system and it gives us these values, 1 up to 128. So 56, what I would do is I would look at his number line right here and I go okay I’ve got 56, what is that in binary or in an octet, if I am putting it into an IP? What I do is I look at this and I go okay, that has to be off because that number is bigger than 56. I basically look for the first number smaller than 56. 64 is too big so I can't have that on. 32 I can have on so I will turn that on because it is smaller than 56. So that means there is a value of 32 here, at least. And then what I do is I subtract the 32 from 56 and that leaves me with 24 left over and then I look. I’ve got 24. 16 is that smaller than 24 or equal to? Yes, it is. So I will turn the 16 value on and subtract 16 from it and that leaves me with 8. Does 8 go into 8? It sure does. Turn that value on. Subtract the 8 off and I got 0 left over so that means the rest of them are 0. So 56, in binary, would be 00111000. So again we don't have to have the leading zeros if we don't want to, but if we were looking at it in octet value, this would be the 8 binary spaces for the octet. If I want to check my work, I bring up the calculator. So all I have to do for that is it has decimal here, 56, hit bin and I can see 111000 is the binary value and again that’s what we’ve got here: 111000. So it’s always helpful to have that calculator to check your work, but you should be comfortable with working through this on your own on paper or in your head, if you’re that lucky to be able to do that.

So pause the CCNA video. I’m going to clean up the slide. Pause the CCNA video. Work through these and then turn it back on and you’ll see me going through them. I’ve cleaned up the slide so we can do the rest of the problems here without having all the stuff from the first one in our way. Pause the CCNA video right now and work through these numbers.

Okay, we’re back. I don't know if you paused the CCNA video or not. Depends on how lazy you want to be. Very important to work through these though and get comfortable with this, but if you are being lazy or, if you have worked through them, either way, I am going to go over them right now. So we’re going to look at number 2 here: 10111010. So all I do is I look at my 8 binary spaces and I put that number here, this binary value and fill it in underneath the 8 spaces here so I could see what the 1 value is or the 0 value isn’t. So I’ve got 10111010. What that tells me is everywhere I’ve got a 1 I have that value that I’ve got to add together. So 128 I got, 64 I don't, 32 I have so I am not adding 64, 32 I do have, so that will be added. 16 I have. 8 I’ve got that value as well, 4 I don't. 2 I’ve got because it’s turned on and 1 I don't have. So I am just going to add these together. 128 and 32 is 160 plus 16 is 176, plus 8 is 184 plus 2 is 186. So 10111010 should equal 186, if I did it right. Let me bring up my calculator and check. I’ve got the calculator here and I am going to put, I have binary selected because we started with a binary number. 10111010 and then all I have to do is hit decimal and I can see the value: 186. A great way to check my work; you do not want to rely on the calculator; however, because the calculator is not available in the testing environment. You’ve got to get at doing this on your own.

With this CCNA exam, you’ve got to basically get an 85 percent so there is not a lot of room for error. So being comfortable with binary and hexadecimal conversion could mean the difference between passing or failing the CCNA test. Let me clean up the slide and then we’ll go in and do problem number 3.

All right, let’s take a look at the next one. We’ve got 00110101. So 00110101. So I don't have 128, don't have 64. I have 32 and 16. Don't have 8. I do have 4. Don't have 2 and I do have a value of 1. So all I have to do now is add these together. We’ve got 32 and 16 which gives me a value of 48 plus 4 is 52 plus another 1 is 53. So my value of 00110101 is 53 in decimal. I’ll clean up the slide and then we’ll go move on to converting this decimal value of 63 to binary.

Now for 63 here, what we’re going to do is I usually just write the number down and then I start comparing my values in my octet. 128 is too big so I am going to put a 0 there. 64 is just too big so I am going to put a 0 there. Now the reason I used the number 63 is because this one is actually really easy to convert. If the number is 1 less than one of the binary values, like 64 here, we have a number of 63. I know immediately that all the bits to the right are turned on to give you a value of 63. 127 would be all ones and then a 0 where the 128 value is. So 63 is simply 111111 or if we were going to do it in octet format, we’d have 00 and then 6 1s following (00111111). And again we could check that out because we can go 32 plus 16 is 48 plus 8 is 56 plus 4 is 60 plus 2 is 62 plus 1 is 63. We can add them up and verify we get that number. So anytime you see a number that is 1 less than any of these values here, everything to the right is turned on. So, if we had the number 7, which is one less than 8, the binary value would be three 1s with 5 preceding 0s.

Let’s go take a look at 26 now. So for 26, do the same thing you did with 63. 0.0.0 except for it’s not a value 1 less than any of these numbers so we are going to have to, there is going to be some 0s and 1s mixed in there. So 26, I know that 128 can't, 64 can't, 32 can't, 16 can. So what I do is I put the 26 here and subtract the 16 from it and I get 10 left over. So I will have a value of 16. 8 is smaller than 10 so I will use that minus 8 is 2. 4 is not smaller or equal to 2. 2 is actually equal to 2 so I will use that value and that leaves me 0 left over. 1 is not smaller or equal to 0. So 26 in binary is 00011010.

Let’s do this last problem and then we’re going to move on to some hexadecimal. Clean up the slide again and we’ve got this binary value of 0000 and then some 1s. So all this is telling me is I add these 1s up. Now I immediately know that this number is 15 because this value is 16 into 0, everything to the right is turned on so I immediately know that that’s a 15. However, if we want to add them up, 8 and 4 gives us 12 plus 2 is 14 plus another 1 is 15. So we can add them up the hard way, if we want to or, again, if it’s all consecutive 1s on the right, whatever this value is, it’s 1 less. So we see all 1s to the right of the 16, we know the value is 15.

Now let’s go in and take a look at hexadecimal. It’s a little bit more complicated and look at converting hexadecimal to decimal and decimal to hexadecimal. All right, hexadecimal numbering is a base 16 so with binary we had 2 to the 0, 2 to the 1. With hexadecimal we’ve got 16 to the 0, 16 to the 1, 16 to the 2, 16 to the 3. I am not going beyond that because the numbers get too large. This is not one of those that’s easy to work within your head like it is with binary because the numbers become so big. 16 to the 0 is 1, because anything to the zero is 1. 16 to the 1 is 16. 16 to the 2 is 256. 16 to the 3 is 4,096 and you can see why I don't want to go 16 to the 4 because that’s basically 4,096 times 16. So we are going to try to stay within 4 hexadecimal spaces. Now with hexadecimal, we can represent 0 through 9 or A through F equals the values 0 through 15. Anytime you see a 0X before a number that tells us that it is a hexadecimal number that follows.

Let’s take a look at this first example right here: 0X means hexadecimal. That’s not a part of the number, 4D32. What that tells us is it tells us what values we have of the 16:0, 16:1, 16:2, 16:3. So basically we’ve got 4 16 to the 3s, D 16 to the 2s, which is 13. We’ve got 13 of those. We’ve got 3 16 to the 1s and 2 16 to the 0s, which is 1. So how we work this out, basically I go 4 times 4,096 plus D is 13 because A is 10, B is 11, C is 12, D is 13. So we’ve got 13 times 256 plus 3 times 16, plus 2 times 1 which is simply 2. So whatever this equals. Let me do this in my head real quick and I will get the answer. So here is the math of it worked out. The only thing I was really able to figure out in my head was the 2 times 1 so everything else I use a calculator for. 4 times 4,096 is 16,384. 13 times 256 is 3,328. Those two added together is 19,712. 3 times 16 is 48. 2 times 1 is 2. 48 plus 2 is 50. 19,712 plus 50 equals 19,762 all from this little number right here of 0X4D32 is that large decimal value of 19,762. So you can see this can get out of hand very quickly.

Let’s look at doing this backward going from 434 to hexadecimal. So this is a decimal value of 432. Let’s convert this to hex. Let me clean up the slide. So if we want to find out 434 in hexadecimal, we do very similar to what we did with binary. We look at these values right here and we want to figure out what they are so we have a value of 1, a value of 16, a value of 256 and a value of 4,096. So I am just looking at 434. So I know 4,000 there is not going to be any value there. 256 does go into 434 and it goes into 434 one time. So I’ve got 1 of the 256s. So, if I subtract 256 off of this, I will have the remainder. Let me do that real quick. So 434 minus 256 with the help of the calculator is 178. Now I know 16 goes into 178 quite a few times there. So it goes in there 11 times. So 16 times 11 is 176 because 16 times 10 is 160. Add one more you got 176. Now, for the number 11, in hexadecimal, A equals 10, B equals 11, because we got 0 through 9 and then A through F. A is the value of 10, B is the value of 11, so we’ve got B amount of 16s after the 256. So 178 minus B16s, which is 176 equals 2. So 1, this one should be fairly easy. We’ve got two of those to give us our hexadecimal equivalent of 434. So we’ve got 0X I don't need to put the leading zeros. 1B2 would be the hexadecimal equivalent of the decimal value of 434. Same process but just not quite as user friendly as binary.

We’re going to go in and we’re going to take a look at some practice questions with the hexadecimal from converting to decimal and decimal to hexadecimal. So for our hexadecimal practice, we’re going to be converting the hex values to decimal and the decimal values to hex. Pause the CCNA video right now. Work them out to the best of your ability then turn the video back on and you will see me going over them. Don't be lazy. Go and turn it off right now. Work them out and then come back and then you’ll see me work them out.

Well I hope you did pause it and here I am back. We’re going to work through these. The first one is hexadecimal. How do I know it’s hexadecimal? Because its got 0X. We’ve got 3FB. So I’ve got 3 of these 256s, 3 of those. I’ve got F of the 16s and I’ve got B of the 1s. So 3 times 256 should be 753. Let me verify that, I could be wrong. Did I say 753? I meant 768. So we’ve got 768 which is 3 times 256. I can't believe I got that right off the top of my head. We’ve got 15 because F is 15 of these 16s. Let me take another guess at this one. I’m going to say this is 240. Let’s check it out with the calculator. It is indeed 240. So we’ve got 15 times 16 and we add that to the 768. Now the last one we’ve got 11 of the 1s and I am going to say that that is 11. I shouldn’t have to go to the calculator for that one. So we add these together and we should have our decimal value of hexadecimal 3FB. So 768 plus 240, let’s do it grade school style here. We’ve got 8, 6 and 4 is 10, carry the 1, 7 and 3 is 10 or if you want to do 8 and 2 is 10 so 1,008 plus 11. Again, not taking any chances here. 8 and 1 is 9 there. We got 1 so 1,019 is our hexadecimal value or decimal value of 3FB in hex. Let’s use our trusty calculator to verify that. So we’ve got hex 3FB decimal 1,019. I am going to clean up the slide and we will move on to the next problem.

All right let’s look at 127 now. So we’ve got the value 127 and we want to find out what hexadecimal values are going to go into it. We’ve got 16 to the 0, 16 to the 1, 16 to the 2. 256 is way too big so we’re going to have 0 of those. 16 will go into 127 and it goes into 127 7 times. I did not do that off the top of my head. I used a calculator for that one. So 16 times 7 is 112. That leaves us 15 left over. So we’ve got 15 of the 1s. How do we represent 15 in hexadecimal? We represent that with an F. So 127 is 0X which is hexadecimal, 7F and again we can verify that with the calculator. Let me open that up. So if we’ve got 127 in decimal and we want the hexadecimal value, its 7F. Again the calculator is helpful for verifying it. It’s very likely that you will get a hexadecimal problem on the test and you will not have a calculator so you are going to have to work with these numbers to get the right answer.

Let’s take a look at 213 now. Just clean up the slide. For 213, I’ll write that down over here, we need to find out what values of hex add up to 213. 256 is too big. I know 213, 16 can go into that quite a few times. It can go into actually 13 times. Now, 13 is represented by the D in hexadecimal so D number of times for this second value here and that gives us 208. So 13 times 16 is 208 and I will subtract that off. I am left over with 5. The value of 5 with the 1s here is simply a five. So our hexadecimal equivalent of 213 is 13 times 16 which is the value D there which is 208 hexadecimal value of D and then 5 left over for the 1s right there so 5 1s, so 0XD5. And again, we can verify that with the calculator. I already did verify it with the calculator but we’ll do it again. So we’ve got decimal value of 213, hit hex, we got D5. Again the 0X in the front simply represents the hexadecimal character because 213 or 127 could also be hexadecimal values. We could have 0X127. That is a perfectly fine hexadecimal value. So it’s important when we’re working with these to specify hex or not hex. Let me clean up the slide and we’ll do this last hexadecimal value 0X1CA.

So for this one here, 0X1CA, 0X means hex, so we’ve got 1, C and A. And again our values are 256, 16 and 1; 16 to the 0, 16 to the 1, 16 to the 2. So we’ve got 1 of the 256s. So 256 plus C of the 16s. C is represented by a 12. So the decimal equivalent of the C would be 12. So we’ve got 12 times 16 because A is 10, B is 11, C is 12. So 256 plus 12 times 16 and then A is 10, 10 times 1 is 10. So the only hard part to figure out right here is the 12 times 16. Let me get my trusty calculator for that. And again, if I was on a test, not going to be available. Going to have to do it the hard way. 12 times 16 equals 192. So 192, so 256 plus 192 plus 10. Let me get my calculator again for that one. 256 plus 192 plus 10 equals 458. So 0X1CA equals 458 in decimal. Again, let’s get the calculator to check it out. 1CA decimal 458.

Let’s go in, the last slide we’re going to be talking about binary to hexadecimal conversion, which I think is actually easier than the hex to decimal. Let’s go take a look at that.

All right, so hexadecimal to binary. It takes 4 binary spaces to represent the number 0 through 15. It takes 1 hexadecimal space to represent 0 through 15. Remember 1 hexadecimal space we can have 0 through 9 or A through F. So that’s 0 through 15. In binary, to be able to represent 0 through 15, we need 4 binary spaces. If we’re looking at the binary values of it, 0000 equals 0. 1111 equals 15. So each hexadecimal value can be represented in 4 binary spaces. Let’s take a look at what I mean. 0X2E4. So if we want to convert this to binary, all we have to do is take each value of hex and put it into binary totally separately. So we can look at the 2 first. 2 is and again we’re using 4 binary spaces for this: 0010. This value being 1, 2, 4 and 8. So just this value right here is the 2. That’s turned on. That gives us 2. E which is 14 is 8 plus 4 plus 2. So 1110. 4 is just the value for 4 turned on: 0100 and then all we do is add them together. So we’ve got 001011100100 is the binary equivalent of 0X2E4. If we do it on the calculator, it will eliminate the leading 0s. Let’s take a look at the calculator. So hexadecimal 2E4 binary 1011100100. So this 4 right here is the 4 there. These 4 represent the E and then these 2 and then 2 0s in front of it would represent the 2. So it’s pretty easy conversion.

Let’s take a look at some practice problems converting hex to binary and binary to hex. All right, again, I am going to ask you to pause the video. Pause the CCNA video right now. Work through these. Convert the hex values. We know they are hex because the 0X and the binary values because there is a bunch of 0s and 1s there to the opposite. So hex will be converted to binary and binary to hex. Go ahead and try to work through these real quick then turn it back on and watch me work through it. I am going to go ahead and pause it myself and clean up the slide.

I am back. Let’s take a look at this first one here: 45A. So we will separate them out and all I have to do is A is 10. So 10 in binary in 4 spaces is the 8 turned on, the 4 off, the 2 on, the 1 off so that’s A which is 10. 5 is a 4 and a 1 so 0 for 8, let me write these out down here. 1, 2, 4, 8 so 5 is 0101 because it’s 4 plus 1. 4 is simply 0100. 0100. Put it all together and what do you get? 010001011010. That is the binary equivalent of hexadecimal 45A. If we want to check it in the calculator, let me bring up the calculator real quick. Hexadecimal 45A hit bin for binary and we’ve got 1000, here is the 3 0s in the background, 1000101, and then the last part 1010. So it’s pretty easy to do that conversion.

Now let’s go in and clean up the CCNA slide and take a look. So here is our next one. We are going to put this into hexadecimal and all I do is I break this into 4 spaces. So we’ve got 1100 and then the other one is 1011. So it’s actually 8 binary spaces here so I use the first 4 and the second 4 and I look at the values. So if this has that, that’s a value of 3. So in hexadecimal, that’s actually just a 3. This has a value of 1, 2 and 8 which is 10, 11. 11 in hexadecimal is the letter B. So 10110011 should equal B3 in hexadecimal. Let’s take a look at our calculator and verify it. So I start with binary and I go with 10110011 hit hex B3 is our answer. Let’s clean up the slide and take a look at the next.

All right, F3B. So we’ve got an F. We’ve got a 3. We’ve got a B. F in binary which is 15 is 8, 4, 2 and 1 all added together. So we’ve got 1111. 3 is the 2 and the 1 so 0011. B is 11 which is 8, 0 for the 4 and then a 1 and a 1. Put them all together and what do we get? 111100111011. So that is our binary equivalent. I am so confident right now that I am not even going to bother checking the calculator. Feel free to check the calculator at home. Now, I am going to clean up the slide and we’ll take a look at this last one here and what this binary value is in hex.

All right, this last one 00111110. Let’s take a look at that and I’ve been keeping the binary at 8 spaces to keep in line with the octets we’ve been looking at. We’re just going to break this up into two separate sections: 0011, that’s one separate hexadecimal number and then 1110 is the second part of it. So we just look at the values: 8, 4 and 2 and 1 so we’ve got 8, 4, and 2, which is 14. 14 in hexadecimal is E because F is 15. We’ve got 3 for binary, 3 in hexadecimal is 3. So 00111110 is 0X3E in hex and again feeling pretty confident. Not worried about checking the calculator.

So let’s go in and do a recap of what we’ve gone over. We have talked about binary numbering base 2. Decimal and binary number conversion, converting back and forth between decimal and binary. We even did some practice. Hexadecimal, base 16, much more of a pain with working with that in decimal because the numbers get a lot bigger. Decimal and hexadecimal conversion with help of the calculator and then we also went in and went through converting between binary and hexadecimal.

I hope you have enjoyed this CertificationKits CCNA training video on binary and hexadecimal number conversion.