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

I don't understand the number represented by the byte 00000111. Need help understanding this whole system.

Need help understanding the byte coding. Don't understand how it all works. Someone needs to break everything down in baby steps.

JT Keller
JT Keller
12,731 Points

The first rule of computer science is that Google is your best friend. Quickly become comfortable using it, because almost any question that you could ask someone else already has. I've included a link to a solid description of the binary number system and how it works below.

TL;DR The binary number system uses base 2 instead of base 10 like what you encounter everyday.

num^num = exponent notation

  • So instead of:
  • 10^2 | 10^1 | 10^0
  • 1 | 9 | 3 The number 193 is really {(1*10^2)+(9*10^1)+(3*10^0)}
  • With binary...think of:
  • 2^4 | 2^3 | 2^2 | 2^1 |2^0 (with the exponent increasing by +1 as you move to the left)
  • 16 | 8 | 4 | 2 | 1 (so here we have 2 to the 0 power = 1, 2 to the 1 power = 2, so on and so forth)
  • 0 | 1 | 1 | 0 | 0
  • (0 means you don't use the value whereas 1 means we do or in mathematical terms 16*0 + 8*1 + 4*1 + 2*0 + 1*0 = 12)

Binary Explanation

1 Answer

Steven Parker
Steven Parker
231,248 Points

In decimal, each digit represents a power of 10, going from right to left. So the number "1247" is 7 one's + 4 ten's + 2 hundred's + 1 thousand.

In binary, each digit represents a power of 2, also going from right to left. So "00000111" is 1 one + 1 two + 1 four (for a total of 7). Just like in decimal, zeros to the left are unimportant. One special thing about binary is that the only digits are 0 and 1, so for each potential power of 2, you'll either have it, or not.

Here's one more binary example: "1011" is 1 one + 1 two + no four + 1 eight (for a total of 11). Remember, right-to-left, and go up one power of 2 each time.

Does that help?