Main content

### Course: Algebra (all content) > Unit 1

Lesson 14: Binary and hexadecimal number systems- Introduction to number systems and binary
- Hexadecimal number system
- Converting from decimal to binary
- Converting larger number from decimal to binary
- Converting from decimal to hexadecimal representation
- Adding in binary
- Multiplying in binary
- Converting directly from binary to hexadecimal

© 2024 Khan AcademyTerms of usePrivacy PolicyCookie Notice

# Converting from decimal to binary

To convert a number from decimal to binary, we need to figure out which combination of 0s and 1s will represent the number. Start by finding the largest power of 2 that fits into the number, write down a "1" to represent that power of 2, and subtract it from the number. We keep going until we reach the smallest power of 2, which is 1.

## Want to join the conversation?

- Can fractions be converted from decimal to binary ?

How ?

What are binary equivalents of some famous numbers in decimal system like pi, e, phi, sqrt(2) ?(16 votes) - At3:45, Do you say the number literally one,one,zero,one? Or would it be okay to say one thousand, one hundred and one?(6 votes)
- thousands, hundreds, millions, billions are terms used in based-10 number system. So we dont really say those when we deal with binary, at least we are not supposed to. But in your mind you can use those terms if they help.(7 votes)

- what if i wanted to convert 0.46 from decimal to binary?(3 votes)
- 0.46 is not a dec. Is'a a double. Right?(2 votes)

- Then How do you convert 8 when there are 2 4s(2 votes)
- there is another way to convert the decimal num to binary num

ex: you have 13 and you want to convert it to binary

13 / 2 = 6 R 1

6 / 2 = 3 r 0

3 / 2 = 1 r 1

1 / 2 = 0 r 1

read from the bottom to the top it is 1101(2 votes)

- I'm pretty confident now converting binary to decimal and vice versa, but you often see people converting actual text to binary, how is this done? I know online converters can be used but what is this process? I don't suppose Khan has a video on this?(3 votes)
- How do I convert a Binary number to a Denary(Decimal) number?(1 vote)
- You take each instance of 1 or 0 and multiply it by its binary place value, then add them up. For example:

1101 in binary = 1(8)+1(4)+0(2)+1(1) = 8+4+0+1 = 13(3 votes)

- But what if you wanna convert a decimal which <0 to binary? do we just simply add a '-' before the binary ?(2 votes)
- What happens if you run out of letters in the alphabet to represent numbers?(2 votes)
- You can take letters from other languages or come up with new symbols...(1 vote)

- I just want to clarify this: Does the binary system consist of only 1's and 0's?(2 votes)
- can you give the reflection of decimal to binary(2 votes)

## Video transcript

Let's see if we can get some experience converting from a decimal representation to a binary representation. Let's start with the fairly
straightforward example with a fairly low number. Let's see if we can convert the number 13 in decimal to binary. And I encourage you to pause the video, and try to work through
it out on your own. So I'm assuming you had a go at it. So the key here is to see if you can deconstruct the number 13
as the sum of powers of two. And then it becomes very straightforward to represent it in binary. Because in binary, you're
essentially saying, well what powers of two do you
need to make up this number. So let's just write
the powers of two here, just to remind ourselves. And I'll go until we go right above 13. So two to the zero is equal to one, Two to the first is equal to 2. Two squared is equal to four. Two to the third is equal to eight. Two to the fourth is equal to 16. So now, I'm above 13, so I have all the powers of two
that I need to construct 13. So what's the largest power of two, that is less than or equal to 13? Well, 16's too large,
well it would be eight. So I could rewrite 13 as eight plus five. Now five is not a power of two, so I have to keep deconstructing that. What's the largest power of two, that is less than or equal to five? We see it right over here, it's four. So let me rewrite that, it's eight plus, instead of writing five, I'll write four plus one, and then the good thing is
at one as a power of two we already see is the largest power of two that is less than or equal to it is one. This already is a power of two. So I now have rewritten this as the sum of powers of two. Notice this is two to the third power. This is two squared, and this
is two to the zero power. Or I could write it like this. I have 1 eight, clearly. I have 1 four, and I have 1 one. So I can add these two, I
can add these three together. 13 could be considered 1
eight plus 1 four plus 1 one. Why is that helpful? Well now, let's go in to binary mode. And think about what each of
the place values represent. So, this is the ones place,
that's the ones place. And then we can go to the twos place. Every time we go to the left, each place we multiply by two. It's the next power of two. Then we go to the fours
place, fours place. And then we go the eights place, eights. In binary I only have
two digits, zero and one. So I either have zero of a
place or I have one of it. So let's go through it. How many ones do I have? Well I have 1 one, so I write that there. How many twos do I have? Well in this representation
I don't have any twos. I have an eight, I have a four and a one. So I'm gonna put I have 0 twos. How many fours do I have? Well I have 1 four. And how many eights do I have? Well I have 1 eight. So 13, or 13 which is a decimal number. If I were to write it in
binary, is one one zero one.