Why is the number range 0-255 common in many computer files?

1.21K views

Why is the number range 0-255 common in many computer files?

In: Technology

6 Answers

Anonymous 0 Comments

Because of binary and bytes.
Computer files work in bytes (and bits). A byte is made up of 8 bits.

Now each bit can only be 1 or 0 (ie. Binary).
Binary doesn’t use base 10 numbering that we are used to, it uses base 2 numbering.

For example, 216 is 2 in the hundreds column (10^2 ), 1 in the tens column (10^1 ) and 6 in the ones column (10^0 ) – ie. Each column is another factor of 10.

Binary does the same, but with 2.
Hence the number 1011 (which is 4 bits) = 1*(2^3 ) + 0*(2^2 ) + 1*(2^1 ) + 1*(2^0 ) = 11 (eleven)

Now back to the byte which is 8 bits. The maximum number you can have (in binary) in 1 byte is all eight 1’s: 11111111.
If you do the binary math for that you’ll find it’s 255.

Therefore since computers use bytes, the range you’ll find is 0 (00000000) to 255 (11111111).

You are viewing 1 out of 6 answers, click here to view all answers.