CE2704 · Digital Logic Design
Theme 1 · Numbers & codes

Number bases & place value

One simple idea — place value — lets the same rule write a number in decimal, binary, octal, or hex. Master it once and every base is the same.

Built from first principles.

Before you start

What you need first

  • Why digital — that a machine stores everything as bits (0/1), so we need a way to write numbers using only those symbols.

What you'll be able to do

  • Read a number in any base using place value.
  • Recognise binary, octal, hex and their digit sets.
  • Use the key fact 1 hex digit = 4 bits, and the units bit / nibble / byte / word.

Start with what you know: decimal

You already use base-10 every day. Look at 2047 — each digit is worth the digit times a power of ten:

Digit2047
Power10³10²10¹10⁰
Place value1000100101
Contributes20000407
$$ 2000 + 0 + 40 + 7 = 2047 $$
Place value, the one idea: each digit is worth the digit × the base raised to its position. Move one place left → multiply by the base. Decimal is base 10 only because we have ten fingers — nothing more.

The same rule works in any base

In any base \(b\), a number's value is the sum of each digit times a power of \(b\):

$$ d_{n-1}\,b^{\,n-1} + \dots + d_2\,b^2 + d_1\,b^1 + d_0\,b^0 $$

The digits \(d_i\) are just symbols from \(0\) up to \(b-1\). Four bases matter to us:

BaseNameSymbolsUsed for
10Decimal0–9Everyday counting
2Binary0 1Inside every digital circuit
8Octal0–7Legacy (Unix permissions)
16Hexadecimal0–9, A–FDatasheets, addresses, colors

When the base isn't obvious we mark it: 1011₂, 0b1011, 0x2F, 2F₁₆.

Binary — base 2

Two symbols, 0 and 1; each digit is a bit (binary digit). Same place-value rule, powers of two:

📐 Worked example

Read 1011₂ in decimal

Bit1011
Power2⁰
Place value8421
Contributes8·21
$$ 8 + 2 + 1 = 11 $$
Powers of 2 worth memorising: 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096. They save you constantly.

Why electronics uses binary — and the units

A transistor is either on or off, so two states are the easiest thing to build reliably. Two levels are also easy to tell apart under noise, and Boolean algebra (Theme 2) gives a clean math for combining them.

The standard units, all built from the bit:
  • bit — one binary digit (0 or 1)
  • nibble — 4 bits (one hex digit's worth)
  • byte — 8 bits (the smallest unit most systems address)
  • word — a CPU's natural width (16 / 32 / 64 bits)

Counting 0–15 in three bases

This little table is the most useful thing in the topic — it appears in every binary/hex problem you will ever do.

DecBinaryHexDecBinaryHex
000000810008
100011910019
200102101010A
300113111011B
401004121100C
501015131101D
601106141110E
701117151111F
Notice 4 bits = 1 hex digit, exactly. That single fact is why hex is the shorthand for binary everywhere.

Octal — base 8 (mostly historical)

Eight symbols, 0–7; each octal digit is exactly 3 bits. You'll mainly meet it in Unix file permissions (chmod 755).

Why octal lost to hex: an 8-bit byte doesn't split evenly into 3-bit groups (8/3 ≈ 2.67), but it splits perfectly into 4-bit groups (8/4 = 2). So hex matches hardware and octal faded.

Hexadecimal — base 16 (the one you really need)

Sixteen symbols: the digits 0–9, then A–F for 10–15. Hex is the human-readable shorthand for binary. Compare:

Binary1011111011101111
HexBEEF

So 1011111011101111₂ = 0xBEEF = 48879 — the hex form is half the length, unambiguous, and groups bits the way hardware does (nibbles, bytes).

You will read hex every working day: memory addresses (0x08000000), register values (0x55555555), I²C addresses (0x68), colour codes (#1F4E79). If you memorise one number system, make it hex.

✏️ Try it yourself

(a) How many distinct values can 6 bits represent? (b) Write decimal 19 in binary, using powers of 2. (c) What is 0xA in decimal? (d) How many hex digits does it take to write one byte?

(a) \(2^6 = 64\) values (0 to 63). (b) \(19 = 16 + 2 + 1\) → bits 4, 1, 0 set → 10011₂. (c) 0xA = 10. (d) 2 hex digits (1 hex digit = 4 bits, 1 byte = 8 bits).

Recap — the whole topic on one screen

IdeaWhat you own now
Place valuedigit × base^position; the one rule behind every base
Binarybase 2, symbols 0/1, each digit a bit
Octal / Hexbase 8 (3 bits/digit, legacy) / base 16 (4 bits/digit, everywhere)
Key fact1 hex digit = 4 bits; 1 byte = 2 hex digits
Unitsbit · nibble (4) · byte (8) · word (16/32/64)

Next topic

Base conversions

You can now read a number in any base. Next: how to move a number between bases — binary ↔ decimal, hex ↔ binary, and the smart route between decimal and hex.

→ Base conversions