Free degree-level computing lessons for careful independent study.

Degree Level Programmes · Formal Computing Foundations · Lesson 5

Number Systems: Decimal, Binary and Hexadecimal

Convert between number bases used in computing.

Lesson overview

Convert between number bases used in computing.

CourseFundamentals of Computing
Topic strandNumber representation
Assessment styleDigital exam practice
EvidenceWorked answer plus justification

Starter: make the model explicit

Before reading the worked example, write down the objects involved, the claim being made and the notation you expect to use. This prevents the common error of calculating before modelling.

Learning objectives

  • Convert small positive integers between decimal and binary.
  • Use hexadecimal as compact notation for binary groups.
  • Explain why base choice changes notation, not the underlying quantity.

Learning outcomes

  • By the end of this lesson, you can convert small positive integers between decimal and binary.
  • By the end of this lesson, you can use hexadecimal as compact notation for binary groups.
  • By the end of this lesson, you can explain why base choice changes notation, not the underlying quantity.

Key vocabulary

basebinaryhexadecimalplace value

What this lesson is about

Decimal is base 10, so each column represents a power of 10: units, tens, hundreds and so on. Binary is base 2, so each column represents a power of 2 and each digit is either 0 or 1. Hexadecimal is base 16, so each column represents a power of 16 and the digits 10 to 15 are written as A to F.

Computers use binary because digital hardware naturally represents two stable states. Hexadecimal is used by programmers because one hexadecimal digit represents exactly four binary bits, making long binary patterns easier to read.

A strong answer does not just convert numbers. It explains the base, the place values, the allowed digits and why the representation is useful in computing.

Terms, acronyms and named methods

These are the phrases and named techniques used in this lesson. Read this section before the worked example so the notation and examples have a clear meaning.

DecimalPhrase. Base 10 notation. It uses digits 0 to 9, and each position is worth a power of 10.
BinaryPhrase. Base 2 notation. It uses digits 0 and 1, and each position is worth a power of 2.
HexadecimalPhrase. Base 16 notation. It uses digits 0 to 9 and A to F, where A = 10 through F = 15. One hexadecimal digit represents four binary bits.
BitAcronym-like term. Short for binary digit. A bit is a single 0 or 1.

Formal notation and definitions

(101101)₂ = 1·2⁵ + 0·2⁴ + 1·2³ + 1·2² + 0·2¹ + 1·2⁰.(2D)₁₆ = 2·16¹ + 13·16⁰ = 45.

How to read the symbols

(101101)2(101101)_2The subscript 2 says the digits are being read in base two.
2k2^kThe place value of the binary column k places from the right, starting at k = 0.
(2D)16(2D)_{16}A hexadecimal numeral. D represents the decimal value 13.

Use the base notation to identify the place values before converting. Decimal uses powers of 10, binary uses powers of 2, and hexadecimal uses powers of 16.

Degree-level reasoning

Representation topics ask you to distinguish mathematical value from machine encoding. The same bit pattern can mean different things under different interpretation rules.

Degree-level answers should mention range, precision, rounding or overflow where those limits affect correctness.

Do not stop at a correct-looking answer. State why the method is valid, whether the result depends on a hidden assumption, and what would count as a counterexample.

Worked formal model

This section shows the model, notation, calculation and interpretation as one worked answer. The notation is part of the reasoning, not decoration.

1. Context and objects

Binary 1011 represents 8 + 2 + 1, so the decimal value is 11.

Objects: the digit string, its base, each place value, and the decimal quantity being represented.

Model cue: Use a place-value table with columns 2^5, 2^4, 2^3, 2^2, 2^1 and 2^0. Each binary digit selects whether that power contributes to the total.

2. Mathematical working

(101101)2=125+024+123+122+021+120(101101)_2 = 1\cdot2^5 + 0\cdot2^4 + 1\cdot2^3 + 1\cdot2^2 + 0\cdot2^1 + 1\cdot2^0(101101)2=32+8+4+1=45(101101)_2 = 32 + 8 + 4 + 1 = 4545=216+13=(2D)1645 = 2\cdot16 + 13 = (2D)_{16}
Plain text version
(101101)_2 = 1*2^5 + 0*2^4 + 1*2^3 + 1*2^2 + 0*2^1 + 1*2^0
= 32 + 8 + 4 + 1 = 45
45 = 2*16 + 13 = (2D)_16

3. How to read the working

  1. Identify the base before reading the digits.
  2. Expand each digit as digit times base raised to its position.
  3. Group binary digits in fours when converting to hexadecimal.
  4. Use the expansion as evidence, not just the final converted number.

4. Computing meaning and check

The base changes the notation, not the quantity. The place-value expansion is the audit trail that proves the conversion rather than a memorised answer.

Now check: Convert (110010)_2 to decimal and hexadecimal. Show the place-value table, not only the final answer.

Worked example

From scenario to formal reasoning

Scenario: Binary 1011 represents 8 + 2 + 1, so the decimal value is 11.

Method: Use the definitions and notation introduced above, then state what the result means in this computing scenario.

Reveal model answer

For (101101)_2, the selected powers are 2^5, 2^3, 2^2 and 2^0. The value is 32 + 8 + 4 + 1 = 45. In hexadecimal, 45 is 2D because 2 × 16 + 13 = 45.

Worked solution structure

How a strong answer should be written

  1. Define: State the domain and the objects under discussion. For this lesson, begin from (101101)₂ = 1·2⁵ + 0·2⁴ + 1·2³ + 1·2² + 0·2¹ + 1·2⁰.
  2. Apply: Use the relevant definition from number representation; do not rely on the diagram, wording or intuition alone.
  3. Check: Test a boundary case, counterexample candidate or representation limit.
  4. Conclude: Write one sentence that connects the formal result back to the computing scenario.

Common misconception

A common mistake is reading binary digits as if they were decimal digits. The symbol 1011 is interpreted by its base.

Guided practice

  1. Convert (110010)_2 to decimal using a place-value table.
  2. Group (110010)_2 as 0011 0010 and convert it to hexadecimal.
  3. Explain why (32)_16 and 50 in decimal are the same quantity written in different bases.
  4. Give one computing context where hexadecimal is more readable than a long binary string.

Quick checks

1. What is (110010)₂ in decimal?

2. What is (110010)₂ in hexadecimal after grouping as 0011 0010?

Digital exam practice

Example exam task

Convert (110010)_2 to decimal and hexadecimal. Show the place-value expansion, the four-bit grouping and a sentence explaining why base changes notation rather than quantity.

Notation toolkit

(n)b(n)_b

Means: the numeral n is being read in base b

How to use: Use it whenever binary or hexadecimal could be confused with decimal.

dibid_i\cdot b^i

Means: a digit multiplied by its place value

How to use: Use it to justify a base conversion step.

24=162^4=16

Means: four binary bits correspond to one hexadecimal digit

How to use: Use it when grouping binary digits into nibbles.

What a good answer is expected to show

A strong answer for this lesson defines the digit string, its base, each place value, and the decimal quantity being represented, applies the number representation method with visible working, and finishes by interpreting the result in the computing scenario.

How to solve it

  1. Identify the base before reading the digits.
  2. Expand each digit as digit times base raised to its position.
  3. Group binary digits in fours when converting to hexadecimal.
  4. Use the expansion as evidence, not just the final converted number.

Model answer

Reveal model answer
(110010)2=125+124+023+022+121+020=50(110010)_2=1\cdot2^5+1\cdot2^4+0\cdot2^3+0\cdot2^2+1\cdot2^1+0\cdot2^0=50(110010)2=(0011 0010)2=(32)16(110010)_2=(0011\ 0010)_2=(32)_{16}

(110010)_2 = 1·2^5 + 1·2^4 + 0·2^3 + 0·2^2 + 1·2^1 + 0·2^0 = 32 + 16 + 2 = 50. Grouping as 0011 0010 gives hexadecimal digits 3 and 2, so the same quantity is (32)₁₆. The base changes the notation, not the underlying number.

Practise next

  1. Convert (110010)_2 to decimal using a place-value table.
  2. Group (110010)_2 as 0011 0010 and convert it to hexadecimal.

Self-marking criteria

  • Uses clear base notation throughout.
  • Shows 32 + 16 + 2 = 50.
  • Groups as 0011 0010.
  • Gives hexadecimal (32)₁₆.
  • Explains the quantity/notation distinction.

Extension

Change one assumption in the worked scenario and decide whether the same method still applies. If it does not, name the exact point where the reasoning breaks.

Study route

Save one clean worked answer from this lesson. Include the problem statement, notation, working, final answer and a short note explaining the computing meaning of the result.

Next lesson: Integer Representation, Overflow and Two's Complement.