Skip to content

Binary & Hexadecimal

Teens & adults Computing Number systems

Decimal is base 10: each digit worth 10× the one to its right. Binary is base 2 — only 0 and 1 — because a transistor is either off or on. Hexadecimal (hex) is base 16: digits 0–9 plus A–F for 10–15.

Reading binary

binary 1 0 1 1 values 8 4 2 1 ← powers of 2 1·8 + 0·4 + 1·2 + 1·1 = 8 + 2 + 1 = 11 in decimal

Hex is binary in disguise

One hex digit = exactly 4 binary bits. That's why programmers use it — compact but instantly convertible:

$FF = 1111 1111 = 255 $A0 = 1010 0000 = 160 (A = 10, then 0) $FF3300 = a 24-bit color: FF red, 33 green, 00 blue

Converting decimal → binary

Repeatedly halve, keep the remainders, read bottom-up: 13 → 6 r1 → 3 r0 → 1 r1 → 0 r1 → reads 1101 = 13.

In ALB ALB source accepts $FF3300 hex colors and 0x04 C-style hex — this is the math underneath both.
Practice

Binary 1101 in decimal = ___

Hex $FF in decimal = ___

Decimal 10 in binary = ___ (digits only)

One hex digit represents how many binary bits?