Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Digital Literacy Computer Basics Computer Basics Binary

How Binary Works?

For example. 00000111 I entered 4 because I counted it from the right to left including the zero before the 1.

Edit: I edited the title of question so its easier to find in google - Konrad

3 Answers

Tim Knight
Tim Knight
28,888 Points

Hi Sammy,

It's not so much about adding the total number of ones up to get the result. Think of each "1" as kind of an on/off switch and each space represents a number. If the space is "1" then you include the number it represents in your addition.

So each of the 8 spaces mean the following

128 - 64 - 32 - 16 - 8 - 4 - 2 - 1

So if you have a binary number like 00000111 you could think of it like:

off - off - off - off - off - on - on - on, then just take the numbers that are "on" and add them up.

So, 4 + 2 + 1 = 7

00000111 = 7

Tim Knight
Tim Knight
28,888 Points

Konrad,

Well it really depends on what you're doing.

As for how you convert that long string, the simple answer is... you don't... because binary is simply 1s and 0s. There are no 3s or 4s or any other number. Now if you're asking how to convert a really long number in general, then yes you break everything up into groups of 8. That's why there a "8 bits in 1 byte".

Let's say I have this:

010101000110100101101101

I break that up into groups of eight:

01010100 01101001 01101101

Then I convert them to decimal

84 105 109

Once you convert them to decimal you could look at a Decimal ASCII chart like: http://asciichart.com/

And see that:

84 = T 105 = i 109 = m

Hex is a different beast altogether.

Konrad Pilch
Konrad Pilch
2,435 Points

Wow amazing! I just understood how to do it wow. Treehouse should make some bookmarks for some posts that you can see as im at college and i cant bookmark this or put on desktop or do anything apart from searching it back again.

Thank you .

Konrad Pilch
Konrad Pilch
2,435 Points

One thing, if we look here there are 6 digits, so does it apply the same terminology? but we start from 6..5..4..3..2..1.. ? and convert it ?

Tim Knight
Tim Knight
28,888 Points

Konrad,

In terms of the link you submitted with the number being 10000 yes, you can just consider there being two zones in the front. 10000 would be 16.

Wow, Best answer ever. Thanks

Wow good answer!

Konrad Pilch
Konrad Pilch
2,435 Points

I agree lol watched so many yt videos and they are soo bad.

What do you do with that 7 ? convert it itnot hex and then letter ? and how do you count e.g :

000030111000004111000350011440001113011410000011111

Does it include the 8 rule that goes from right and when u counted 8 , u start from 1 and count to 8 again?

Now I don't feel so bad for asking the question! LOL

Actually, the reason why I asked is that I know how to do it, I am not very good at explaining it to my students. So, I thought if I asked the question the way I did, you would give me the simplest explanation you could. It worked!

My Grade 3 students started giving me the answers before I even completed the explanation! (i.e., students are smarter than their teacher . . . .)