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

C# C# Streams and Data Processing Parsing Data Working with Integers

Byte - what exactly is it?

I thought a byte was a value that contained 8 binary digits, e.g., 100111001 Why then are we saying a byte can take values from 0 - 255. I'm a bit confused.

2 Answers

Steven Parker
Steven Parker
231,198 Points

The "0 - 255" spec is the decimal equivalent of the binary values. For unsigned values, 00000000 is the smallest binary byte value, which is 0 in decimal; and 11111111 is the largest, which is 255 in decimal.

Ok. So in other words, a byte has about 256 permutations of bit numbers?

Steven Parker
Steven Parker
231,198 Points

There are exactly 256 (2^8) permutations of 8 binary digits.

This was a lot of help. Thank you.