Welcome to number systems! In everyday life, we use decimal or base-10, which has ten digits from 0 to 9. But computers work differently. Binary uses only two digits: 0 and 1, representing on and off states in electronic circuits. Hexadecimal uses sixteen symbols: digits 0 through 9, plus letters A through F for values 10 through 15. These systems are fundamental to how computers store and process information.
Let's understand how binary works. In binary, each position represents a power of 2, starting from 2 to the power 0 on the right. For the binary number 1011, we have positions for 8, 4, 2, and 1. To convert to decimal, we multiply each binary digit by its position value and add them up. So 1 times 8, plus 0 times 4, plus 1 times 2, plus 1 times 1, equals 8 plus 0 plus 2 plus 1, which gives us 11 in decimal.
Now let's explore hexadecimal. Hexadecimal uses 16 symbols: digits 0 through 9, and letters A through F representing values 10 through 15. Each position represents a power of 16. For the hexadecimal number 2AF, we have positions for 256, 16, and 1. The letter A represents 10, and F represents 15. To convert to decimal, we calculate 2 times 256, plus 10 times 16, plus 15 times 1, which equals 512 plus 160 plus 15, giving us 687 in decimal.
Binary and hexadecimal have a special relationship. Every 4 binary digits can be represented by exactly 1 hexadecimal digit. To convert binary 11010101 to hex, we first group the binary digits into chunks of 4 from right to left: 1101 and 0101. Then we convert each group separately. 1101 in binary equals 8 plus 4 plus 0 plus 1, which is 13 in decimal, represented as D in hex. 0101 equals 0 plus 4 plus 0 plus 1, which is 5 in both decimal and hex. Combining these gives us D5 in hexadecimal.
These number systems have countless real-world applications. In computer programming, memory addresses are often written in hexadecimal, like 0x2A4F. Web designers use hex color codes - for example, hashtag FF0000 represents pure red. In digital electronics, binary represents the fundamental on-off states of circuits. The beauty of these systems is their efficiency: the 8-bit binary number 11111111 becomes simply FF in hex, much more compact than 255 in decimal. Whether you're programming, designing circuits, or working with digital data, understanding binary and hexadecimal is essential for computer science.