Binary Numbers and Bits
Part of: Data
Everything Is Bits Computers store and process all data using binary , a number system with only two digits: 0 and 1. A single binary digit is called a bit . Because hardware is built from switches that are either off (0) or on (1), binary maps directly onto the physical machine. Eight bits grouped together form a byte . A byte can represent 256 different values (from 0 to 255) because each of its 8 bits independently doubles the number of possibilities: 2^8 = 256. Place Value in Base 2 In the decimal system you know, each place is a power of 10. In binary, each place is a power of 2 . Reading right to left, the places are 1, 2, 4, 8, 16, 32, and so on: - The binary number 1011 means 8 + 0 + 2 + 1 = 11 . - The binary number 10000 means 16. To convert a binary string to a decimal value, add the place value wherever a 1 appears: The trick value = value 2 + digit walks the digits left to right, shifting the running total one place each step. This is exactly how positional notation works. Why Binary Matters - Reliability : distinguishing two states (on/off) is easier and less error-prone than ten. - Universality : numbers, text, images, and sound are all ultimately stored as sequences
Challenge: Binary to Decimal