Skip to main content

Number Bases

Every number you have ever written is a coded message, and the code depends on a single hidden choice: the base. When you write "204," you are not writing two-hundred-and-four as a single symbol — you are giving instructions that say "two hundreds, no tens, four ones." Change the base, and the same digits mean something entirely different. Understanding number bases means understanding the machinery of counting itself, and it is the key that unlocks how computers, network addresses, colors on your screen, and even ancient astronomy all work.

This is one of those topics where a small idea — that the position of a digit carries weight — turns out to be one of the most powerful inventions in human history. Once you truly grasp place value, binary and hexadecimal stop being mysterious and become obvious.

Learning Objectives

  • Explain what a number base is and how positional (place-value) notation works.
  • Read and write numbers in binary (base 2), octal (base 8), and hexadecimal (base 16).
  • Convert whole numbers from any base to base 10 and back.
  • Convert directly between binary, octal, and hexadecimal using digit-grouping shortcuts.
  • Explain clearly why computers use binary and where hexadecimal is used in practice.
  • Trace the historical development of place-value systems from Babylon to Leibniz.

Quick Answer

A number base (or radix) is the number of distinct digits a system uses and the multiplier between adjacent columns. In base 10 (decimal), we use ten digits (0 09 9) and each column is worth ten times the one to its right. Binary (base 2) uses only 0 0 and 1 1; octal (base 8) uses 0 07 7; hexadecimal (base 16) uses 0 09 9 then A–F for ten through fifteen. To convert to base 10, multiply each digit by its place value (a power of the base) and add. To convert from base 10, repeatedly divide by the base and read the remainders bottom-up. Computers use binary because electronic switches are naturally two-state (on/off), and hexadecimal is a compact human-friendly shorthand for binary.

Where It Came From

For most of history, humans counted without place value, and it made arithmetic agonizing. Roman numerals, for instance, have no zero and no columns — MCMXLVII (1947) cannot be added by lining up digits. Every calculation needed a counting board or an abacus because the notation itself did no work.

The first great breakthrough came from Babylon around 2000–1800 BCE. Babylonian mathematicians developed a positional system in base 60 (sexagesimal). Why 60? It was a practical compromise. Sixty is divisible by 2, 3, 4, 5, 6, 10, 12, 15, 20, and 30, which makes fractions like a third or a quarter come out cleanly — a huge convenience for merchants and astronomers dividing quantities. The Babylonians tracked the motions of the stars with this system, and its fingerprints are still on your wristwatch: 60 seconds in a minute, 60 minutes in an hour, and 360 degrees in a circle are all direct inheritances from Babylonian base-60.

The Babylonians, however, had no true zero for centuries — an empty column was ambiguous, a genuine problem. The decimal place-value system with a real zero was perfected in India by roughly the 6th–7th century CE, associated with mathematicians such as Brahmagupta, who gave explicit rules for computing with zero. This system traveled through the Islamic world — the scholar al-Khwarizmi (9th century, whose name gives us "algorithm") wrote influential texts on it — and reached Europe through Fibonacci's Liber Abaci (1202).

The final chapter belongs to Gottfried Wilhelm Leibniz, who around 1679–1703 worked out binary arithmetic — counting with only 0 0 and 1 1. Leibniz was fascinated that all numbers could be built from two symbols, and he saw philosophical beauty in it (he linked 0 0 and 1 1 to "nothing" and "God"). He could not have known that two and a half centuries later, binary would become the literal language of every computer on Earth, because a switch that is either off (0 0) or on (1 1) is the simplest, most reliable thing electronics can build.

Place Value: The Engine Behind Every Base

The heart of every base system is positional notation: the value of a digit depends on its position, and each position is a power of the base bb. For a base bb, the columns from right to left are worth:

b0, b1, b2, b3,  b^0,\ b^1,\ b^2,\ b^3,\ \dots

In base 10, that means the ones, tens, hundreds, thousands columns. The number 3705 3705 literally means:

3705=3×103+7×102+0×101+5×100 3705 = 3\times 10^3 + 7\times 10^2 + 0\times 10^1 + 5\times 10^0

=3000+700+0+5 = 3000 + 700 + 0 + 5

A base needs exactly bb distinct digits, from 0 0 up to b1b-1. That is why base 2 needs only 0 0 and 1 1, and why base 16 needs extra symbols (A–F) once the single digits run out. The general rule for a number with digits dndn1d1d0d_n d_{n-1}\dots d_1 d_0 in base bb is:

value=i=0ndibi \text{value} = \sum_{i=0}^{n} d_i \, b^{\,i}

Worked example. Interpret 1101 1101 in three different bases.

  • Base 10: 1×1000+1×100+0×10+1=1101 1\times 1000 + 1\times 100 + 0\times 10 + 1 = 1101.
  • Base 2: 1×8+1×4+0×2+1×1=13 1\times 8 + 1\times 4 + 0\times 2 + 1\times 1 = 13 (in decimal).
  • Base 8: 1×512+1×64+0×8+1=577 1\times 512 + 1\times 64 + 0\times 8 + 1 = 577 (in decimal).

Same four symbols, three completely different quantities. That is the whole idea in one line.

Binary, Octal, and Hexadecimal

These three bases dominate computing, so it is worth meeting each one.

Binary (base 2) uses only 0 0 and 1 1. Each column doubles: 1,2,4,8,16,32, 1, 2, 4, 8, 16, 32, \dots A single binary digit is called a bit. Eight bits form a byte, which can represent 28=256 2^8 = 256 different values (0 0 to 255 255).

Worked example — binary to decimal. Convert 101102 10110_2.

1×16+0×8+1×4+1×2+0×1=16+4+2=22 1\times 16 + 0\times 8 + 1\times 4 + 1\times 2 + 0\times 1 = 16 + 4 + 2 = 22

So 101102=2210 10110_2 = 22_{10}.

Octal (base 8) uses digits 0 07 7, with columns 1,8,64,512, 1, 8, 64, 512, \dots Octal was popular in early computing and still appears in Unix file permissions (e.g. chmod 755).

Worked example — octal to decimal. Convert 3478 347_8.

3×64+4×8+7×1=192+32+7=231 3\times 64 + 4\times 8 + 7\times 1 = 192 + 32 + 7 = 231

So 3478=23110 347_8 = 231_{10}.

Hexadecimal (base 16) uses 0 09 9 then A, B, C, D, E, F for ten through fifteen. Columns are 1,16,256,4096, 1, 16, 256, 4096, \dots Hex is everywhere in computing: memory addresses, color codes like #FF8800, and byte dumps.

Worked example — hex to decimal. Convert 2AF16 2\text{AF}_{16}. Here A =10= 10 and F =15= 15.

2×256+10×16+15×1=512+160+15=687 2\times 256 + 10\times 16 + 15\times 1 = 512 + 160 + 15 = 687

So 2AF16=68710 2\text{AF}_{16} = 687_{10}.

Here is a quick reference showing how the same values look across bases:

DecimalBinaryOctalHex
0000000
5010155
81000108
10101012A
15111117F
16100002010
25511111111377FF

Converting From Decimal: The Division-Remainder Method

To convert a decimal number into another base, repeatedly divide by the base and collect the remainders. The remainders, read from last to first (bottom to top), give the answer.

Worked example — decimal to binary. Convert 4510 45_{10} to binary.

  • 45÷2=22 45 \div 2 = 22 remainder 1 1
  • 22÷2=11 22 \div 2 = 11 remainder 0 0
  • 11÷2=5 11 \div 2 = 5 remainder 1 1
  • 5÷2=2 5 \div 2 = 2 remainder 1 1
  • 2÷2=1 2 \div 2 = 1 remainder 0 0
  • 1÷2=0 1 \div 2 = 0 remainder 1 1

Reading the remainders bottom-up: 101101 101101. Check: 32+8+4+1=45 32 + 8 + 4 + 1 = 45. Correct, so 4510=1011012 45_{10} = 101101_2.

Worked example — decimal to hexadecimal. Convert 70010 700_{10} to hex.

  • 700÷16=43 700 \div 16 = 43 remainder 12 12 (which is C)
  • 43÷16=2 43 \div 16 = 2 remainder 11 11 (which is B)
  • 2÷16=0 2 \div 16 = 0 remainder 2 2

Reading bottom-up: 2BC16 2\text{BC}_{16}. Check: 2×256+11×16+12=512+176+12=700 2\times 256 + 11\times 16 + 12 = 512 + 176 + 12 = 700. Correct.

The Binary–Octal–Hex Shortcut

Because 8=23 8 = 2^3 and 16=24 16 = 2^4, you can convert between binary and octal/hex by simply grouping bits — no arithmetic through decimal needed. This is why hex is so beloved: it is just binary in compact clothing.

Binary to hex: group the bits into fours from the right; each group becomes one hex digit.

Worked example. Convert 110101102 11010110_2 to hex. Group as 1101 0110. Now 11012=13=D 1101_2 = 13 = \text{D} and 01102=6 0110_2 = 6. So the answer is D616 \text{D6}_{16}.

Binary to octal: group into threes from the right.

Worked example. Convert 110101102 11010110_2 to octal. Group as 11 010 110, i.e. 011 010 110. Then 011=3 011 = 3, 010=2 010 = 2, 110=6 110 = 6, giving 3268 326_8. Check via decimal: 110101102=128+64+16+4+2=214 11010110_2 = 128+64+16+4+2 = 214, and 3×64+2×8+6=192+16+6=214 3\times 64 + 2\times 8 + 6 = 192+16+6 = 214. Correct.

Real-World Applications

  • Computer hardware and memory. Every value inside a computer is stored in binary. Memory addresses and machine instructions are read and debugged in hexadecimal because it maps cleanly to bytes.
  • Web and graphic design. Colors are written as hex codes: #RRGGBB. For example #FF0000 is pure red because FF (255 255) is the maximum for the red channel.
  • Networking. IPv6 addresses are written in hexadecimal, and subnet masks are best understood in binary. MAC addresses are hex too.
  • File permissions. Unix/Linux permissions use octal — chmod 644 sets read-write for the owner and read-only for others, where each octal digit encodes three permission bits.
  • Timekeeping and angles. The Babylonian base-60 legacy survives in 60-second minutes, 60-minute hours, and the 360-degree circle.
  • QR codes and error correction. Data encoding schemes rely on base conversions and binary polynomial arithmetic.

Common Mistakes

Mistake 1: Reading division remainders top-to-bottom. When converting from decimal, students often write the remainders in the order they computed them. Why it's wrong: the first remainder is the least significant (rightmost) digit, not the leftmost. Correction: always read the remainders bottom-up — the last remainder you compute is the leading digit.

Mistake 2: Confusing the number of digits with the base value. People think base 2 "goes up to 2" or base 16 "goes up to 16." Why it's wrong: a base-bb system has digits 0 0 through b1b-1; the digit bb never appears alone. Correction: base 2 uses only 0 0 and 1 1; base 16 uses 0 09 9 and A–F (which is 15 15), and 16 16 itself is written 1016 10_{16}.

Mistake 3: Grouping bits from the left. When using the binary-to-hex shortcut, students group the leftmost bits first. Why it's wrong: place value is anchored on the right, so incomplete groups must be on the left (pad with leading zeros). Correction: always group into fours (hex) or threes (octal) starting from the right, padding the leftmost group with zeros if needed.

Comparison and Connections

The four common bases differ only in their radix, but each is suited to a purpose:

BaseNameDigitsMain use
2Binary0, 1Internal computer storage/logic
8Octal0–7Unix permissions, legacy systems
10Decimal0–9Everyday human arithmetic
16Hexadecimal0–9, A–FCompact display of binary data

The deep connection is that octal and hexadecimal are just binary compressed — because 8 and 16 are powers of 2, three or four bits collapse into a single digit. Decimal, by contrast, is not a power of 2, which is exactly why converting between decimal and binary requires real division rather than simple grouping. This same place-value idea extends to non-integer bases and even to positional systems for fractions (using negative powers of the base after a "radix point").

Practice Questions

Recall

What digits are used in hexadecimal, and what decimal values do the letters A through F represent?

Answer: Hexadecimal uses 0 09 9 and A, B, C, D, E, F, representing 10,11,12,13,14,15 10, 11, 12, 13, 14, 15 respectively.

Understanding

Explain why 10 10 means a different quantity in every base, and give its decimal value in base 2, base 8, and base 16.

Answer: "10 10" always means "one lot of the base plus zero." So 102=2 10_2 = 2, 108=8 10_8 = 8, and 1016=16 10_{16} = 16 in decimal. The symbols are identical; the base sets the value of the leading column.

Application

Convert 15610 156_{10} to both binary and hexadecimal.

Answer: Binary: 156=128+16+8+4=100111002 156 = 128 + 16 + 8 + 4 = 10011100_2. Hex: 156÷16=9 156 \div 16 = 9 r 12 12(C), then 9÷16=0 9 \div 16 = 0 r 9 9, giving 9C16 9\text{C}_{16}. Check: 9×16+12=156 9\times 16 + 12 = 156.

Analysis

Without converting through decimal, convert 1F416 1\text{F}4_{16} to binary, then to octal. Explain why the two shortcuts can be chained.

Answer: Each hex digit becomes 4 bits: 1=0001 1 = 0001, F =1111= 1111, 4=0100 4 = 0100, so 1F416=0001111101002=1111101002 1\text{F}4_{16} = 0001\,1111\,0100_2 = 111110100_2. Regroup into threes from the right: 111 110 100 =7648= 764_8. Chaining works because binary is the common "atomic" layer — both hex (4-bit groups) and octal (3-bit groups) are built directly on powers of 2.

FAQ

Why do computers use binary instead of decimal? Electronic components are most reliable when they only have to distinguish two states — on and off, high and low voltage. Two states are easy to build, easy to keep distinct despite noise, and map perfectly onto the logic values true/false. Building reliable ten-state circuits would be far harder and more error-prone, so binary won.

If binary is what computers use, why is hexadecimal everywhere? Long binary strings are hard for humans to read and easy to miscount — 11010110 versus D6. Since one hex digit equals exactly four bits, hex gives a compact, error-resistant way to write and read the same binary data. It is for human convenience, not the machine's.

Is there a "best" or most natural base? No base is mathematically more "correct." Base 10 is popular only because we have ten fingers. Some argue base 12 is more practical (it divides evenly by 2, 3, 4, and 6), and base 60 gave the Babylonians rich divisibility. The right base depends on the job.

How do I convert fractions to another base? Use columns of negative powers after a radix point (b1,b2, b^{-1}, b^{-2}, \dots). To convert a decimal fraction to binary, repeatedly multiply by 2 and record the integer parts top-down (the mirror image of the division method for whole numbers).

What is the difference between a bit and a byte? A bit is a single binary digit (0 0 or 1 1). A byte is a group of 8 bits, able to represent 28=256 2^8 = 256 distinct values. Bytes are the standard unit for measuring memory and file sizes.

Quick Revision

  • Base bb: uses digits 0 0 to b1b-1; column values are powers of bb: b0,b1,b2, b^0, b^1, b^2, \dots
  • To decimal: multiply each digit by its place value and sum: dibi\sum d_i b^i.
  • From decimal: divide repeatedly by bb; read remainders bottom-up.
  • Binary \leftrightarrow hex: group bits in fours from the right.
  • Binary \leftrightarrow octal: group bits in threes from the right.
  • Key equalities: 8=23 8 = 2^3, 16=24 16 = 2^4; 1 byte =8= 8 bits =256= 256 values.
  • Hex letters: A=10=10, B=11=11, C=12=12, D=13=13, E=14=14, F=15=15.
  • History: Babylon (base 60) → India (decimal + zero) → Leibniz (binary, ~1700).

Prerequisites

  • Divisibility and factors — understanding why base 60 and base 12 are convenient.
  • Modular arithmetic — closely tied to remainders, the engine of base conversion.

Next Topics

  • Binary arithmetic and two's complement — how computers actually add and store negative numbers.
  • Prime numbers and factorization — deeper number-theoretic structure built on integers.