Binary — base 2 explained
Decimal is base 10: each digit position represents a power of 10. The number 347 means 3×100 + 4×10 + 7×1. Binary is base 2: each digit position represents a power of 2. The binary number 1011 means 1×8 + 0×4 + 1×2 + 1×1 = 11 in decimal.
A single binary digit (0 or 1) is a bit. Eight bits make a byte. A byte can represent 256 different values (0 through 255 in decimal, 00000000 through 11111111 in binary). This is why many limits in computing are multiples of 256 — file permissions, color channel values, ASCII character codes.
Converting decimal to binary means repeatedly dividing by 2 and recording remainders. Converting binary to decimal means multiplying each bit by its positional power of 2 and summing the results. An online converter handles this instantly.
Hexadecimal — base 16 and why developers use it
Hexadecimal uses 16 symbols: 0–9 and then A–F for values 10–15. One hex digit represents exactly 4 bits (a nibble). Two hex digits represent exactly 8 bits (one byte). This is why hexadecimal is so useful — it's a compact, human-readable representation of binary data.
A byte with value 255 in decimal is 11111111 in binary — eight digits. In hex, it's FF — two digits. For memory addresses, color codes, cryptographic hashes, and network identifiers, hexadecimal is the standard notation.
CSS colors are the most common hex in everyday web development: #FF5733 is R=255, G=87, B=51. Each pair of hex digits is one byte, representing one color channel's intensity from 0 to 255.
- 0 in decimal = 0 in binary = 0 in hex
- 10 in decimal = 1010 in binary = A in hex
- 16 in decimal = 10000 in binary = 10 in hex
- 255 in decimal = 11111111 in binary = FF in hex
- 256 in decimal = 100000000 in binary = 100 in hex
Practical uses in web and software development
Hex color codes in CSS are the most visible everyday use. Understanding hex lets you mentally decode colors — #000000 is black (all zeros), #FFFFFF is white (all max), #FF0000 is pure red (red channel max, green and blue zero).
Unix file permissions (755, 644) are typically written in octal (base 8), not hex, but understanding the binary representation helps: 7 = 111 in binary means read+write+execute, 5 = 101 means read+execute.
Network programming frequently uses hex for IP addresses, MAC addresses, and packet inspection. Cryptographic outputs like SHA256 hashes and JWT signatures are always displayed in hexadecimal.
