We’re moving to a new home! Our website is currently in test mode while we update and transfer our content. Some pages and resources may be temporarily unavailable. We’ll be back with all resources shortly. Thank you for your patience.

CIE IGCSE | 1.1.2 Binary, Hex And Conversions

Lesson objective

Convert positive integers between denary, binary and hexadecimal, using values up to 16 bits.

Learn

1.1.2 | BINARY, HEX AND CONVERSIONS

HEX IN EVERYDAY COMPUTING

Hexadecimal appears wherever people need to read or write binary values compactly. One hex digit stands for four bits, so a long binary pattern becomes shorter without changing its value.

Common uses of hexadecimal
UseExampleWhy hex helps
Web colour codes#24988FSix hex digits represent three colour channels compactly.
Memory addresses0x1A2FProgrammers can inspect locations without reading a long binary pattern.
MAC addresses02:1A:2B:3C:4D:5EA typical 48-bit MAC address can be written as six two-digit hex groups.
Diagnostic and error codes0x2FA compact code is easier to display, copy and look up, including on a small device screen.
Debugging raw dataAF 3C 12Each pair represents a byte, making stored data easier to inspect.

These address and diagnostic examples illustrate notation, not a particular real device or error. A code’s meaning depends on the system’s documentation. The prefix 0x commonly identifies a hex number in programming; it is not part of the digits used in your conversion answers.

Hex is easier for humans to handle, but the computer still represents and processes the underlying data in binary. Further benefits are explored in 1.1.3.

COLOUR CODES | THREE PAIRS, THREE CHANNELS

A six-digit web colour code follows #RRGGBB: two hex digits each for red, green and blue. Each pair ranges from 00 to FF, representing a channel value from 0 to 255.

#24988F

Red: 24₁₆ = 36₁₀
Green: 98₁₆ = 152₁₀
Blue: 8F₁₆ = 143₁₀

This is the green accent used on this website. In RGB notation it is rgb(36, 152, 143). The six hex digits describe 24 bits of colour-channel data: three channels of eight bits each.

Example six-digit RGB colour codes
ColourHex codeRed, green, blueSample
Red#FF0000255, 0, 0
Blue#0000FF0, 0, 255
White#FFFFFF255, 255, 255
Black#0000000, 0, 0

The colour-code example uses more than 16 bits overall to show a real application. The syllabus conversion exercises on this page stay within 16 bits.

01 | SAME VALUE, DIFFERENT NOTATION

A computer stores a value as bits. A programmer may write that same value in denary or hexadecimal to make it easier to read. Changing the number system changes the notation, not the underlying quantity.

Denary is base 10, using 0 to 9. Binary is base 2, using 0 and 1. Hexadecimal is base 16, using 0 to 9 and A to F.

Three ways to write the same value
SystemBaseExample representing forty-five
Denary1045
Binary200101101
Hexadecimal162D

Subscripts identify a base when necessary: 45₁₀, 00101101₂ and 2D₁₆. Without a base label, “10” is ambiguous: it can mean ten, two or sixteen.

This lesson uses unsigned whole-number values up to 16 bits. Negative-number representation is covered in 1.1.6.

02 | PLACE VALUE IS THE KEY

In denary, moving one position left multiplies the place value by 10: 1, 10, 100. Binary uses powers of 2, so its place values double. Hexadecimal uses powers of 16.

Place values depend on the base
SystemFour place values, left to right
Denary1000, 100, 10, 1
Binary8, 4, 2, 1
Hexadecimal4096, 256, 16, 1
Hexadecimal columns: each step left multiplies the place value by 16
16³16²16¹16⁰
4096256161
1234
1 × 4096 = 40962 × 256 = 5123 × 16 = 484 × 1 = 4

1234₁₆ = 4096 + 512 + 48 + 4 = 4660₁₀. Start at the right with 1, then move left through 16, 256 and 4096. The place values are denary values, even though the digits placed in those columns are hexadecimal digits.

The specification allows binary lengths up to 16 bits, equivalent to four hex digits. That is why all four columns are included.

Each digit contributes digit × place value. Add those contributions to find the denary value. In binary, a 1 includes that place value and a 0 contributes nothing.

03 | BINARY TO DENARY: ADD THE ONES

Place-value chart for 00101101₂
1286432168421
00101101
00101101₂
= 32 + 8 + 4 + 1
= 45₁₀

Start at the right with 1 and double as you move left. Include only the columns with a 1. Leading zeros do not add anything.

Quick check: the leftmost 1 is in the 32 column, so the answer must be at least 32 and less than 64.

04 | DENARY TO BINARY: CHOOSE PLACE VALUES

To convert 156 to an 8-bit pattern, start with 128. Put 1 in a column if its value fits into the amount remaining; otherwise put 0.

Constructing 156 as an 8-bit binary number
Place valueDecisionRemaining
128Use it: write 128
64Too large: write 028
32Too large: write 028
16Use it: write 112
8Use it: write 14
4Use it: write 10
2Write 00
1Write 00
156 = 128 + 16 + 8 + 4
156₁₀ = 10011100₂

Finish all the columns required by the question. If it asks for 8 bits, write exactly eight bits, including leading zeros where needed.

05 | ANOTHER METHOD: DIVIDE BY TWO

Repeated division is an alternative to choosing place values. Divide by 2, record the remainder and continue with the whole-number quotient until it reaches zero.

Repeated division of 45 by 2
DivisionQuotientRemainder
45 ÷ 2221
22 ÷ 2110
11 ÷ 251
5 ÷ 221
2 ÷ 210
1 ÷ 201

Read the remainders from bottom to top: 101101. Pad on the left for an 8-bit answer: 00101101.

Reading the remainders downwards is a common mistake. Check by converting your final binary pattern back to denary.

06 | HEX DIGITS AND FOUR-BIT GROUPS

Hex needs six symbols beyond 9: A=10, B=11, C=12, D=13, E=14 and F=15. The next value after F is 10₁₆, which means sixteen in denary.

The sixteen hexadecimal digits
DenaryHexFour-bit binary
000000
110001
220010
330011
440100
550101
660110
770111
881000
991001
10A1010
11B1011
12C1100
13D1101
14E1110
15F1111

One hex digit corresponds to four bits, because four bits have 2⁴ = 16 patterns. A group of four bits is called a nibble.

Hex is a compact way to write the bits. It does not mean that the computer stores a letter A instead of its binary pattern.

07 | CONVERT DIRECTLY BETWEEN BINARY AND HEX

Binary to hex: group bits in fours from the right. Pad the leftmost group with zeros if needed, then convert each group separately.

10101111₂ → 1010 1111 → A F → AF₁₆
10010₂ → 0001 0010 → 1 2 → 12₁₆
Two nibbles become two hex digits: 10101111₂ → AF₁₆

Keep the groups in the same left-to-right order: A then F.

Hex to binary: replace each hex digit with its four-bit pattern, preserving the zeros within each group.

3C₁₆ → 3 = 0011, C = 1100
3C₁₆ = 00111100₂

Writing 3 as 11 and simply joining it to 1100 loses the four-bit grouping. Write each nibble in full first, then adjust the overall width only if the question allows it.

08 | HEX TO DENARY: MULTIPLY AND ADD

2A₁₆ = (2 × 16) + (10 × 1) = 42₁₀
12C₁₆ = (1 × 256) + (2 × 16) + (12 × 1)
       = 256 + 32 + 12 = 300₁₀

Convert letter digits to their denary values before multiplying. The rightmost place is 1, then 16, then 256, then 4096.

Common mistake: treating 12₁₆ as twelve in denary. It is (1 × 16) + 2 = 18₁₀.

09 | DENARY TO HEX: DIVIDE BY SIXTEEN

Repeated division of 300 by 16
DivisionQuotientRemainderHex digit
300 ÷ 161812C
18 ÷ 16122
1 ÷ 16011

Read the remainder digits from bottom to top: 12C₁₆. Check it by multiplying through the hex place values.

You can also convert denary to binary first, then group the bits into nibbles. Use the method you can explain and check reliably.

10 | EXTEND TO SIXTEEN BITS

The method stays the same for longer patterns. Sixteen binary bits correspond to four hex digits. The largest unsigned 16-bit value is 2¹⁶ − 1 = 65535; there are 65536 possible values including zero.

1234₁₆ = 0001 0010 0011 0100₂
= (1 × 4096) + (2 × 256) + (3 × 16) + 4
= 4660₁₀

511₁₀ = 0000 0001 1111 1111₂ = 01FF₁₆

Leading zeros preserve an unsigned value but show a required width. 1FF and 01FF have the same value; use four digits when the question requests that format.

11 | EXPLORE AND CHECK A VALUE

Enter an unsigned value in one system. The explorer displays the equivalent denary, 16-bit binary and four-digit hex. Try your own conversion first, then use it to check.

Use 0–65535 in denary, up to 16 binary bits or up to four hex digits. Spaces are allowed between binary groups; omit base prefixes.

12 | PRACTISE WITHOUT THE EXPLORER

Use the methods above and show your working. For longer conversions, keep each four-bit group clearly spaced while calculating.

CONVERSION LAB

Enter your answers. Binary patterns must keep the requested width; spaces and hex letter case are accepted.

MATCH THE TERMINOLOGY

Choose the term that matches each description.

Terminology

Terminology

Denary

Base 10.

Binary

Base 2.

Hexadecimal

Base 16; digits 0–9 and A–F.

Nibble

A group of four bits.

Place value

The value of a position in a number.

Unsigned 16-bit range

0 to 65535 inclusive.

Questions

Questions

APPLY YOUR SKILLS

Enter your answers. Binary patterns must keep the requested width; spaces and hex letter case are accepted.

TICK-BOX QUIZ

Select all correct choices. Each exact set earns one point.

1. What does hexadecimal F represent in denary?
2. Which values equal 42 denary?
3. How many bits correspond to one hex digit?
4. Which statements are correct?
5. What is the greatest unsigned 16-bit value?
6. Which binary pattern equals 12 hex?

WRITTEN QUESTIONS

Answer in your book first. These are practice questions and suggested answers, not official exam questions or mark schemes.

1. Convert 11001010 binary to denary and hex. [3 marks]

2. Convert 511 denary to 16-bit binary and hex. [3 marks]

3. Explain why each hex digit can be converted independently into four bits. [2 marks]

4. Show how 2F hex becomes denary. [2 marks]

Flashcards

Flashcards

Click a card to flip it. Tick the cards you need to revisit.

0 cards selected for revision.

    Selections are kept while this page is open.

    Workbook

    Workbook

    A place to practise, explain and apply your learning.

    COMING SOON

    The workbook for 1.1.2 Binary, Hex And Conversions is coming soon. For now, use the Questions tab and write your answers in your exercise book.