Now to prove us let's use a calculator here's the calculator on my Mac.
If I type 255 notice in binary that's eight binary 1s.
That's not very clear so let me use a Windows calculator.
So here's my Windows calculator.
I'm going to specify binary one two three four five six seven eight.
Notice the Windows calculator puts a gap between the four binary values makes it easier to read but
in a IP address there is no gap like that but I often write it that way just to make it easier to read.
Notice the value is 255 in decimal but in binary it's eight binary 1s.
Now we'll talk about hexadecimal later.
That's FF in hexadecimal but 255 in decimal equates to 8 binary1s.
Okay so here's a another example.
What is the binary equivalent of 1 in decimal.
So it's not this because that would be 128.
It's not this because there would be 64.
It's not this because there would be 32.
Same there.
Same here.
And so forth.
We wouldn't use any of those.
The only bit that we would set on is that. So that in binary equals that in decimal.
So there you go.
But we typically write it this way because an IPv4 address consists of 4 groupings or 4 octets
as it's called.
So for groupings of 8 bits or 4 octet.
So again 1 in decimal we would write like this in binary.
Okay so let's see if you can answer this question.
Pause the video if you need more time I'm going to go through the question and then I'll answer it.
What is the binary equivalent of 192 in decimal?
So what is a 192 equal to, to which binary bits here
would you set on to get 192?
Now pause the video at this point if you need more time.
Otherwise I'm going to explain the answer.
Now the easiest way to work this out is look at 192 does 192 minus 128 equal a positive or negative
value?
In this case, it's going to equal 64 so we know that we need to set this value on because that plus and
it's quite easy here 64 equals 192.
So those two bits need to be on the rest or set off because 192 minus 128 minus 64 equals zero or that
plus that equals this.
So in other words, 1 1 followed by 6 binary 0s equals 192 in decimal.
Hopefully, that makes sense but he has another example in case it doesn't.
I'm going to teach you a trick in this example as well.
We've got 253 here.
What is the binary equivalent of 253?
Hint: think about working backwards.
If you need more time pause the video now.
Otherwise I'm going to tell you the answer. Okay So 253
we could do the method where we minus 128 to make sure that it's not less than zero.
Or we could work backwards and say 255 minus 253 equals 2.
So we want to remove 2 out of the equation and leave all the other values on.
So in other words, we could just state immediately turn this off and leave everything else on.
So in other words, 128 plus 64 plus 32 plus 16 plus 8 plus 4 plus 1 equals 253. So you
could either try and work it out by saying 255 minus 128 gives me a value and then subtract
64 from that and then subtract 32 from that, subtract 16 from that, and so forth until you get to zero.
Or you could just say turn 255 minus 253 equals 2.
I know that 2 should be removed.
Everything else should be on.
So that equals 253 or to write it in binary.
It looks like that.
Now before we go any further I've created some quizzes on my website which gives you unlimited examples
of converting binary to decimal and decimal to binary.
So if you go to davidbombal.com/freequiz you can get access to these quizzes or
simply look under free, free quiz to get access to all of these free quizzes.
So as an example here we've got a quiz asking you to convert decimal to binary so I know that that is
the answer.
So I'm going to collect check answer and I'm told that that is correct.
Here's another example.
What is the binary equivalent.
Let's put a incorrect number in so something like that.
Check on answer.
I'm told that that is wrong.
Try again.
You can keep on trying.
Or you can click give up if you want to get the answer.
So the software keeps track telling you how many you got correct and how many you gave up on.
So you can do that quizzes an example or you can go to the opposite which is binary to decimal.
So I'll just put in 123
Check the answer and you can see it's wrong.
Try again or click give up and it'll tell you what the correct answer is.
So those are free quizzes on davidbombal.com that you can use if you want to practice.