Number Bases Guide

Why Different Bases?

Computers store everything as binary (base 2) — switches that are either on (1) or off (0). Decimal (base 10) is what humans use daily. Hexadecimal (base 16) is used in programming because each hex digit represents exactly 4 binary bits, making it a compact representation of binary data. The hex digits are 0–9 and A–F (A=10, B=11, C=12, D=13, E=14, F=15). Octal (base 8) was common in older computing systems and some Unix file permission notations.

Decimal to Binary Conversion

Method: divide the decimal number by 2 repeatedly, noting the remainder each time. Read remainders from bottom to top. Example: 13 in binary: 13÷2=6 r1, 6÷2=3 r0, 3÷2=1 r1, 1÷2=0 r1 → read up: 1101. Check: 1×8 + 1×4 + 0×2 + 1×1 = 8+4+0+1 = 13 ✓. Decimal to hex: divide by 16 repeatedly. Decimal to octal: divide by 8 repeatedly.

Common Hex Values

In programming and web design, hex values appear constantly: 0xFF = 255 (maximum single byte), 0x00 = 0 (minimum), 0x0F = 15 (lower nibble), 0xF0 = 240 (upper nibble), 0x7F = 127 (largest positive signed byte), 0x80 = 128, 0x1000 = 4096, 0xFFFF = 65535. Web colours: #FF0000 = pure red, #00FF00 = pure green, #0000FF = pure blue, #FFFFFF = white, #000000 = black. RGB values 0–255 convert directly to 00–FF in hex.

Binary Arithmetic

Adding binary: 0+0=0, 0+1=1, 1+0=1, 1+1=10 (carry 1). Example: 0110 (6) + 0011 (3) = 1001 (9). Bitwise operations: AND (both 1), OR (either 1), XOR (different), NOT (flip). These operations are fundamental in computer processors, cryptography, and network subnetting. IP addresses are 32-bit binary numbers divided into 4 groups of 8 bits (octets). 192.168.1.1 in binary: 11000000.10101000.00000001.00000001.

Number Base Converter (Binary, Hex, Octal)

Results update automatically as you type

Enter values above to calculate