Overview

All digital computers are electronic devices that ultimately can do one thing: detect whether an electrical signal is on or off. This basic information, called a bit (binary digit), has two values:

Key Concepts

Number Systems

Binary (Base-2)

Uses digits: 0, 1

Example: 10110₂

Used for: Basic computer storage

Octal (Base-8)

Uses digits: 0-7

Example: 75021₈

Used for: Compact representation of binary

Decimal (Base-10)

Uses digits: 0-9

Example: 97425

Used for: Human calculations ("Standard" number system)

Hexadecimal/Hex (Base-16)

Uses digits: 0-9, A-F (10-15)

Example: 54A2DD₁₆

Used for: Compact binary representation, colors

Converting to Decimal

To convert a number from any base to decimal (base-10), multiply each digit by its place value and sum the results.

Converting from Decimal

To convert from decimal to another base:

  1. Integer divide the decimal number by the target base and set the remainder to the side.
  2. Repeat the process for the quotient until it becomes 0.
  3. The remainders will be the digits of the number in the new base, from bottom to top.

Quick Conversions Between Bases

There are shortcuts for converting between binary, octal, and hexadecimal without going through decimal!

Pro Tip: Memorize these patterns:

  • Octal: Each digit = 3 binary digits
  • Hex: Each digit = 4 binary digits
  • For Octal ↔ Hex: Use binary as a bridge!

Examples

Converting to Decimal

Binary to Decimal

11012 = (1×23) + (1×22) + (0×21) + (1×20) = 8 + 4 + 0 + 1 = 13

Octal to Decimal

1758 = (1×82) + (7×81) + (5×80) = 64 + 56 + 5 = 125

Hex to Decimal

A516 = (10×161) + (5×160) = 160 + 5 = 165

Converting from Decimal

Example: Convert 92 to Binary

92 ÷ 2 = 46 remainder 0
46 ÷ 2 = 23 remainder 0
23 ÷ 2 = 11 remainder 1
11 ÷ 2 = 5  remainder 1
5 ÷ 2 = 2   remainder 1
2 ÷ 2 = 1   remainder 0
1 ÷ 2 = 0   remainder 1

Reading from bottom up: 9210 = 10111002

Example: Convert 25847 to Hexadecimal

25847 ÷ 16 = 1615 remainder 7
1615 ÷ 16 = 100  remainder 15 (F)
100 ÷ 16 = 6     remainder 4
6 ÷ 16 = 0       remainder 6

Reading from bottom up: 2584710 = 64F716

Quick Conversions Between Bases

Binary ↔ Octal

Group binary digits by threes (from right)

Binary to Octal:
111 101 010 = 752₈
↓   ↓   ↓
7   5   2

Octal to Binary:
375₈ = 011 111 101₂
       ↓   ↓   ↓
       3   7   5

Binary ↔ Hexadecimal

Group binary digits by fours (from right)

Binary to Hex:
1010 1111 = AF₁₆
↓    ↓
A    F

Hex to Binary:
FD₁₆ = 1111 1101₂
       ↓    ↓
       F    D

Octal ↔ Hexadecimal

Convert through binary as an intermediate step:

Octal → Binary → Hex:
375₈ → 011111101₂ → FD₁₆

Hex → Binary → Octal:
FD₁₆ → 11111101₂ → 375₈

Practice Problems

Problem 1 Junior

Convert 3676₈ to hexadecimal.

Problem 2 Junior

How many 5's appear in total when writing all decimal numbers from 1 to 75 in octal?

Problem 3 Intermediate

Evaluate the expression and express the final answer in hex:

10₂ * 61₁₆ + 1001₂ * (1011₂ - A₁₆)

Problem 4 Intermediate

Convert 2023₁₀ to octal. Write the octal digits in ascending order.

Then convert this reordered octal number to hexadecimal.

Problem 5 Senior

Evaluate and express in base 16 if both numbers are hexadecimal:

1F * 4D