Binary, Hex, and Data Representation
Every file, image, sound, and message on a computer is ultimately stored as 1s and 0s. Understanding binary and hexadecimal unlocks how computers store numbers, text, images, and everything else.
Key Concepts
Binary (Base 2)
Computers use base 2 because transistors have two states. Each digit is a bit (0 or 1). Eight bits = one byte. The number 42 in binary is 00101010 (32+8+2=42). Converting: write powers of 2 from right (1,2,4,8,16,32...) and add the ones.
Hexadecimal (Base 16)
Hex uses digits 0-9 then A-F (A=10, B=11, ... F=15). One hex digit = 4 bits. 0xFF = 255 = 11111111 in binary. Hex is compact — programmers use it constantly for memory addresses, colors (#FF5733), and byte values. 0x1A = 26 decimal.
Representing Text and Images
ASCII and Unicode map numbers to characters: 'A'=65, 'a'=97, '0'=48. UTF-8 handles every language. Images are grids of pixels, each pixel stored as 3 bytes (RGB): red, green, blue, 0–255. A 1920×1080 image = 1920×1080×3 ≈ 6MB uncompressed.
🆕 Number System Converter
Convert between decimal, binary, and hexadecimal. See how data is stored.
✅ Check Your Understanding
1. How many bits are in one byte?
2. What is 0xFF in decimal?
3. How are text characters stored in a computer?