[Intro music playing] So, welcome to this TeachElectronics.com presentation
of Binary to Decimal Conversion. What we’re gonna do is we’re gonna teach you
how to convert, and there’s only one learning objective: at the end of this lesson, you’re
gonna be able to convert binary numbers to their decimal equivalents. So take a look
at the examples at the bottom. Notice that there are five decimal numbers:1, 7, 10, 64,
and 100. And over to the right are their binary equivalent. So the number on the right, seven
zeroes and a one, that’s the same equivalent, that’s the same number as 1 in decimal. If
I were to write the second number down in binary as 111, those three ones represent
the number in binary that is decimal 7. So what we’re gonna do is we’ll pick a couple
of random binary numbers, and we’ll walk through how it works. Now you probably noticed in
the binary column that there’s a lot of leading zeroes. And you also know that in the decimal
system, we don’t really use leading zeroes. Writing 00046 is not the way we write the
number 46. Over on the right are the same numbers as the binary numbers in the center
column, but they have no leading zeroes. And we’re going to see a lot of leading zeroes,
so let’s talk about how that works. In computers, most binary numbers, and we don’t store decimal
numbers — there’s no place to store a 7 or a 6 or a 4 in a computer, because the only
thing you can store in a computer are the numbers 1 and 0. So you have to figure out
kind of a secret code that changes the numbers we know of as 6 and 4 and 3,000 into only
ones and zeroes. And, of course, that’s the binary code that you see here. In computers,
binary numbers are always stored in multiples of 8 bits, or 8 digits. I’m gonna interchange
the word bit and digit; they both mean the same thing. It’s one of the digits of a binary
number. Any number in a computer is stored as a sequence of ones and zeroes, but they’re
always stored in multiples of 8. We either store 8 bits or 8 ones and zeroes, or 16 bits
or 32 bits. We usually store a number of bits divisible by 8. When we store the number 1
or 7 or 10, in binary, which is the third column over on the right, when we think about
it, we don’t think about those leading zeroes, but when we store it, we’re gonna store them
in a storage place that requires 8 ones or zeroes, because each of those eight memory
storage places has to be either a one or a zero. So we use those leading zeroes to say
there’s no 1 here; there’s no 1 here, there’s no 1 here, but they still have to be there
because you can’t have nothing in a computer. I can’t store seven nothings and a one. I
can only store eight ones or zeroes or any combination of eight ones or zeroes. What
we do is we put the leading zeroes in whenever we store any number that has less than eight
bits. And the same thing with 16 bits. If we have 16-bit numbers and our number is less
than that, we zero-fill, or left-fill as zeroes, any binary numbers to get to that even number
of eight or sixteen. Although the numbers on the right are the real binary numbers,
you’ll often see them with the leading zeroes, meaning that this is how we’re gonna store
it in a computer. So get used to seeing both, or either. They’re both correct. I’m gonna
use the leading zeroes in this presentation, because we’re going to act like our binary
numbers are gonna be stored in a computer, so I want you to get used to seeing ’em. Well, we’re gonna talk about column weights
in this presentation, so we need to understand what that means. What I’ve done, I’ve put
the decimal number 101 and the binary number 101 up on the screen, so I wanna talk about
that a little bit. You all know if I tell you what does the number 101 — how much is
that?– that’s really easy. You’re gonna say one hundred and one. You’re gonna say that
because you understand the decimal system. You’ve been trained since you were a tiny
child how the decimal system works, and you’ve been trained with column weights. You’ve been
trained that the column weight of the 1 on the right is one — it represents one thing,
or one unit, or one dollar, or one of whatever we’re counting. The zero in the center, you’ve
been trained to realize that that zero is really the tens column, and this tells you
how many tens are in the number. In this particular number, there are no tens. And of course,
in the third column, you’re taught that this column, a number in this column, represents
the number of one hundreds in your number, so in this case, you can look at that number
and say there’s one one-hundred, there’s no tens, there’s one one. So we have the number
one hundred and one. Binary counting over on the right isn’t anything like that. We
don’t use column weights of ten; we use column weights of two. So our column weight columns
go one, two, four, eight, sixteen, thirty-two, instead of one, ten, one hundred, one thousand,
ten thousand, and so on. So you need to get used to that column weight system and realize
that number 101 is a different quantity than the decimal 101. And another thing we do quite often is we
provide subscripts. I’m gonna put the subscripts up here. You can see the subscript in decimal,
“10,” and the subscript in the binary number of “2.” Here’s what that means: The subscript
“10”says, “I am a base-ten number. I am a decimal number, and the decimal numbering
system has a base of 10. Because everything, each of the columns is a multiplier or 10.
So it’s a base-10, and we have ten numbers that we use to count. On the right-hand side,
you’ll see the subscript 2 on the 101, and what that tells you is this is a base-2 number.
Everything in this system is based on powers of two instead of powers of ten. The first
column on the right represents a one; the next column to the left represents a two,
then a four, then an eight, then a sixteen, and so on. We’ll talk more about that in a
minute. For right now, just so that we’re not confused, when I show you the number 101,
I’m gonna put the 10 up there, or the 2 up there, to remind you that the 101 base-10,
or the 101 subscript 10, is a decimal number, and on the right, the 101 base 2, or the 101
subscript 2, represents a binary number. How do we determine what a number is? The decimal
is easy. Again, you’ve been trained in that and taught on that every since you were born.
Now, you probably weren’t taught exactly this way, but I’m gonna lay this out for you in
a powers-of-ten format. What’s in the green box on the left represents the third digit.
What’s the third digit represent?And we can see here it says one times ten squared, or
one times ten to the second power. Well, ten squared is one hundred, so one times one hundred
is one hundred. So in decimal, a 1 in the third position from the right represents the
quantity 100. If it were a 2 inside the green box here, we would write “two times ten squared”
which would make it worth 200. That’s the column weight. The column weight of this column
is in the hundreds. Well, looking at the center column, in this case, there’s no tens, and
that’s ten to the one. This says zero times ten to the one, meaning it’s a zero because
that’s what’s in that digit, the zero. And we multiply it times ten because it’s the
ten column, and ten to the one, or ten to the first power, is ten. So this says zero
times ten is zero, so we don’t really add anything, so so far we’ve come up with one
hundred from the first digit, nothing from the second digit, and the third digit, the
one, or the first digit on the right, represents one times ten to the zero, and ten to the
zero is one, so one times one is one. So the third digit is a one. This tells us that we
have one hundred plus zero plus one, or one hundred one. That’s how we figure out what
the number is, or how we figure out how large the number is, or what its quantity or size
is. Well, in the binary numbering system, it’s exactly the same. The only difference
is notice that the exponents are still the same: two and one and zero. Notice that the
one times, or zero times, are still the same. But notice the number now becomes TWO. TWO
to the second power. TWO to the first power. TWO to the zero power. Why? Because it’s a
base-2 system. Later, when we learn octal, which is a base-eight system, those twos are
all gonna get replaced with eight. And later, we’ll get into the hexadecimal system, which
is a base-16 system, and we’ll replace all of those twos with the number 16. So they’re
all the same; it’s just that each column has a different weight based on the power of the
base. This one in the third column says “We’re base 2 (that’s the two)” and two squared is
two times two is four, meaning that the third column has a weight of four. So one times
four is four. So the one in this column represents the quantity four. Well, we move over here,
same idea with zero — there’s nothing — and this happens to be the two-to-the-ones column,
or the twos column. This says there’s no twos, ’cause zero times anything is zero. So there
are no twos in this number, and then lastly, the far-right-hand digit is a one, but it’s
two to the zero, and anything to the zero is a one. So one times one is one. So what
this number says is “add one times two squared, which is four, plus nothing, which is nothing,
we still got four, and this last equation over here, one times two to the zero represents
the number one.” So this means four plus one. So when we do that, we lay it out. I’ll lay
’em both out here for you. We’ll say that the decimal number 101 represents 100 + 0
+ 1, or what we know of as one hundred one. The 101 in binary means something totally
different, because we used different column weights. And this number says 4 + 0 + 1, or
5. In the decimal system, the number 101 represents one hundred one. In the binary system, and
I made a mistake there — it’s a 10. That should be a two. Should be 5 with a 2 subscript,
made a mistake. So the 5 subscript 2 represents that this number is 5 in the base-2 system. So that’s how the base systems work. Let’s
figure out how we change the numbers. We start out with a blank piece of paper. Start out
by writing the number 1 at the top right, as I’ve done here. On here, I’ve made it brighter.
I’ve dimmed the numbers that are coming up. After you write 1, go to the left of it, write
a 2, and then you’re gonna keep doubling the number all the way as far to the left as you
wanna go. Huh. So we double the 2, we get a 4. Double 4 we get 8, double 8 we get 16,
double 16 we get 32, and we continue doing that. Now, how long do we do it? Well, since
we’re working with 8-bit numbers, we’ve gotta have 8 numbers up top. We have to have one
to represent every bit in the 8-bit number. So as you can see, the 1, 2, 4, 8, 16, 32
represents six numbers, but we’re gonna use 8 bits, not 6 bits, so we’re gonna write 2
more numbers, so we’ll double the 32 to 64, double it to 128. Now, these numbers will
stay at the top of the page and we’ll write our binary number under it and then figure
out what its value is. Pick a number, I just picked a couple of random numbers. Down at
the bottom of the page, you’ll see 10101010. I just picked that ’cause it’s a nice pattern.
Okay, and I picked the one to the right ’cause it’s just a number. It’s ones and zeroes.
So what we’re gonna do is we’re gonna take each of these two numbers. We’re gonna walk
through the conversion process so that you can easily figure out what the number 10101010
base 2 represents in the decimal numbering system. So here we go. Well, let’s work on the first number, the
10101010. That’s the number. We’re trying to solve the problem, what is that number
worth in the decimal numbering system? Remembering that each of the digits in a binary number
has a specific column weight. What that 1, 2, 4, 8, 16, 32 up top says is the bit, the
farthest bit on the right in an 8-bit binary number, has a column weight of 1. The next
number, the 2, means the next number over, the second from right in a binary number,
has a column weight of 2. The next bit a 4 and the next bit 8. And so one. So we’re gonna
walk through one bit at a time and we’re gonna add up those numbers to see what our total
is. We’re gonna add up the column weights and you’re gonna notice these zeroes. We’ve
got some zeroes in our binary number. We’re not gonna add anything if we hit a zero. So let’s start with the right-hand bit. The
right-hand bit is a 1, and down at the bottom, in our binary number, it says, well, the binary
number that we’re solving for has a zero in that bit, so there are no ones in that number.
So we don’t add anything to our total. We start our total at zero, of course. And we
say, well, how much do we have to add up to get to the number we’re looking for? This
zero in bit position one tells us, well, there’s nothing here, there’s no ones. So let’s move
to the next bit. Well, the next bit is a one, and if we look up top, we see that that’s
column weight of 2, meaning there is a 2 in this number, so we need the quantity 2 to
be in our number. So we’re gonna start adding numbers up, and the first number we’re gonna
add is 2. We’ll put a box over on the right, and we’ll say, okay, because there’s a 1 in
the second bit, and the weight of the second bit is 2, we know our number, our total, has
a 2 in it. So we’ll place the 2 in the box. And we’ll keep looking for numbers in this
box until we’ve added up whatever we need to get the correct total. Now, as we move
left from the second bit, you’ll see we have three zeroes in different positions in the
8-bit number. We can ignore those, because if the zero’s under a 16, it means there’s
no sixteens in the number, you don’t have to worry about it. If the zero’s under a 32,
then you say, well, we don’t have to worry about that. So we can ignore the zeroes and
just look for the value of the ones. So here’s one. Now, this one is located in position
4, if I’m counting from the right, one two three four. It’s the fourth number over from
the right. It’s a one. Well, what’s the fourth number at the top of the page? It’s an 8.
This column, or this one, represents the column weight of 8. So that means there’s an 8 in
our number that we have to add. So we’re gonna add that 8 to our total. So far we’ve got
a total of 10. We’re gonna keep going as long as we have ones, and we’ll eventually get
the correct total that’ll gie us the sum of all these numbers, therefore, what its decimal
value is. Well, the next one over is in the sixth position
from the right, and if there’s a one in the sixth position from the right, it means that
that’s the 32 column-weight column, so we’re gonna need to add 32 to our number to find
out what the total is. Let’s move the 32 into our sum. We’re now — we’ve now summed three
numbers — the 2, the 8, and the 32. We only have one more one, so we can move to that
one, and we can say the last one in the number, the far-left bit, the eighth bit of a binary
number has a column weight of 128. Therefore, we need to add 128 to our number. So when
we add 128, we wind up with a grand total of 170, and 170 is the correct answer for
what is the decimal value of this binary number. So down the bottom, we can replace our answer
of three question marks with 170 subscript 10, meaning in the decimal system, that’s
the subscript 10, this number has a value of 170. So we’re done filling out this number.
Now, I did it kind of the long way. When we do the next number, I’ll show you a shorter
way. And it’s quicker once you get used to it. But I wanted to get you to understand
that each column weight goes up:1, 2, 4, 8, 16, 32. If I was teaching the decimal system
right now, guess what I’d do? I’d write 1, 10, 100, 1000, 10000, 1000000, okay? I’d keep
adding a zero to each of the number, or multiplying by 10 each time. That’s what the decimal number
means, base 10. Each column goes up times ten. This is a base-2 system. Each column
goes up times two. So as long as we write these numbers down, 1, 2, 4, 8, 16, 32, 64,
and we put a 1 or a 0 under each of those numbers, we can figure out what the total
of the number is. Let’s take a look at the right-hand number
on the bottom, 00110110, subscript 2, meaning it’s the binary number, so we have this 8-bit
binary number. It’s got 4 ones in it. What columns do those 4 ones represent? Well, the
two ones on the right represent the 2s column and the 4s column. Remember now, if this was
decimal, that would be the 10s column and the hundreds column. You need to be able to
shift back and forth between the powers that we’re talking about. Right now, we’re talking
powers of 2. So we know we have a 1 in the 2s column, 1 in the 4s column, 1 in the 16s
column, and one in the 32s column. So of course, what that means is to find out what this number
is, add the numbers 32, 16, 4, and 2. And we’ll have our total. And so, sure enough,
if we add up 32, 16, 4, and 2, we’re gonna get the number 54. Two plus four is six, plus
six is 12, plus 2 is 14, carry the 1, 3 + 1 + 1 is 5. So the number is 54. We can now
at the bottom right of the screen replace those three question marks with the number
54, meaning 00110110 is the equivalent of decimal 54. That’s it! That’s all you have
to do to convert binary to decimal. Write 1, 2, 4, 8, 16, 32, and so on up top for however
many bits are in the binary number. Write the zeroes and ones underneath it, and every
number that has a 1 underneath it, add that to your total, and you’ll come up with a winner
every time. So here, I wrote the actual ones and zeroes
right underneath the number, and that’s probably how you’d do it, if you were doing it on a
piece of paper. I did it ’cause it was easier to keep the slide straight if I did it this
way. But if I was doing it on a whiteboard right now, I’d write those numbers on the
board, 1, 2, 4, 8, 16, 32, 64, 128, and then underneath it, I’d write 10101010 and I’d
say “What does that represent in decimal?” And you could just look at that and say, well,
oh, I got it! I’d take a 128, ’cause there’s a 1 under it, I add a 32, ’cause there’s a
1 under it, I add an 8 and a 2 because there’s ones under it, and I don’t add any of the
other numbers, and if I add all those numbers up, I’m gonna get 170. I’m done. It’s that easy! Just run out the ones and
zeroes, add up all of the column weights in the top that have a 1 under ’em, and you got
a winner. So let’s try that second number. Here’s the second number. The 00110110. I’ve
written that one out the exact same way. But on this one, you can say, “Well, this is easy,
too. I got one 32, plus one 16, that’s, it looks like 48, plus one 4, that’s 52, plus
one 2, that’s 54. If I add those four numbers up, 32, 16, 4, 2, I get 54, and I’ve got the
correct answer. That’s it. That’s all there is to it. It’s that easy. And you’ll find,
when we get to hexadecimal and octal, it’s the same idea. We just put different column
weights at the top of the screen, and we’re still gonna get the right answer each time. So here’s the deal. Time for you to practice.
I’m gonna have a slide that pops up next and it’s going to have five 8-bit binary numbers
on it. Now what I want you to do is pause the slide, figure out what the answer to each
of those 8-bit binary numbers is, write the answer down, and while the video’s paused.
When you’ve done and got all your answers, just forward the video and in about 5 seconds,
I’ll walk through the answer to each one of the problems. So what’s gonna happen when
the next slide pops up, you’ll see on the screen a countdown, that does 5, 4, 3, 2,
1, 0. If you pause it at any time while it’s counting down, you’ll pause the video. You
can try and work out the numbers for yourself. Okay? If you don’t choose to do that, if you
just wanna go right to the answers, just let it scroll for five seconds, and then the answers
will pop up and I’ll walk you through each answer. So, you got the idea? Next slide,
pause the video before the countdown gets to zero, and you can work ’em out for yourself,
or just let the video run, your choice. Here we go. There’s your 5 numbers. I’m gonna count down.
There’s 5, 4, 3, 2, 1, and 0. So now I’ll give you the answers. Okay, so here’s the
first number. 00000101. Pretty easy. There’s only two ones. The far-right-hand 1, if I
were to write all the ones and zeroes up top, write underneath the column weights that I
showed here, I’d have a 1 under the number 1 and a 1 under the number 4. So what’s the
answer? Easy. 4+1. Next number. Well, if I wrote that 8-bit number one bit at a time
underneath the numbers at the top of the screen, I’d have a 1 under the 64, a 1 under the 16,
a 1 under the 4, a 1 under the 1. If I added all of those guys up, I’d get 85. See the
number 85 over on the right. That’s how I got the decimal equivalent, or that’s how
I got the number that 01010101 represents. Pretty easy, I think. I hope you see that
now. Well, the next number. Again, let’s see, we got 4 ones, and if we lay out the ones
underneath the column weights up top, we’re gonna have a 1 underneath the 128, the 64,
the 8, and the 4, and way over on the right in green, I add those 4 numbers up, and this
represents the number 204. Next number. Only 3 ones here, and they would be under the number
128, 16, and 2. What’s the answer? 128 + 16 + 2 or 146, so this 8-bit number represents
the decimal number 146. And the last one, of course, worst case, what happens if everything’s
a 1? Well, if everything’s a 1, I’ve got a 1 under every single number, gotta add ’em
all up, and it turns out when I add up 128 + 64 + 32 + 16 + 8 + 4 + 2 + 1, I get 255.
So that’s what 8 ones represents in decimal, when I write 8 ones in binary. That’s is.
That’s how it works. So, write your numbers up top, put the ones and zeroes underneath,
starting at the right, line them up, one number per column, one bit per column, keep ’em lined
up correctly, and then if you just add up those top numbers that are on top of ones,
you’ll always get the correct answer. Here’s the procedure. you could take a picture
of this slide if you wanted to. You could write this down, pause the video and write
it down, whichever is the most convenient for you. You may already remember and know
exactly what this procedure is and you’re good. So whatever’s best for you, but I’ll
walk through it one time quickly. 1. At the top of a piece of paper, write the
number 1. That’s what we’ve done. Keep doubling it to the left until you have
as many numbers as the number of ones and zeroes in your binary number. So if you only
have a four-bit binary number, like 1010, you only have to write 1, 2, 4, 8, because
you don’t need to go any farther than the number of bits you have. Step 3. Place the
right-hand bit — and that’s important. Gotta be the right-hand bit, not the left-hand.
Place the right-hand bit of the binary number under the one on the right, up at the top
of the page. Continue placing, step 4, each one or zero of the binary number under the
decimal numbers going off to the left. Keep the bits in their original order. When you
read the numbers back underneath these red numbers at the top, the ones and zeroes should
be the same sequence that you were reading when you put ’em up there. And of course,
when you’re done, go to every number up here at the top in the top row that has a one underneath
it. Add those numbers up. That’s gonna give you the sum. That sum is the number. So I hope that this has helped out. I hope
that you understand this. If not, you can certainly email me. I’m [email protected]
I’m also [email protected] Either one, you can email or you can go to the TeachElectronics.com
site and find a place to ask a question. So, glad to have you. I hope you now understand
better, or really well, how to convert binary numbers into decimal. Thanks for watching. [Outro music playing]


Leave a Reply

Your email address will not be published. Required fields are marked *