How do we convert reliably between denary, binary and hexadecimal by hand?
Convert whole numbers between denary, binary and hexadecimal using place value, repeated division and nibble grouping
A focused answer to the O-Level Computing point on number base conversion. Converting between denary, binary and hexadecimal using place value, repeated division by two, and grouping binary into nibbles.
Reviewed by: AI editorial process; not yet individually human-reviewed
Have a quick question? Jump to the Q&A page
Jump to a section
What this dot point is asking
SEAB wants you to convert whole numbers fluently between denary (base 10), binary (base 2) and hexadecimal (base 16). The central idea is that every base uses the same positional place-value rule, so converting is just a matter of deciding which powers (of two or of sixteen) you are counting in, and grouping binary into nibbles to reach hexadecimal.
The answer
Denary to binary
There are two reliable methods. Pick whichever you find quicker and check with the other.
Method 1: subtract descending powers of two. Write the place values . Put a under the largest power that fits, subtract it from the number, and repeat with the remainder. Put where a power does not fit.
Method 2: repeated division by two. Divide the number by , writing the remainder ( or ) each time, until you reach . The remainders read from the bottom upwards give the binary digits.
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
read up: 101110 -> 46 = 00101110
Binary to denary
Add the place values of every column that holds a :
Binary to hexadecimal
Because one hex digit is four bits, group the binary into nibbles from the right, padding the left with zeros if needed, then convert each nibble:
binary: 1101 0110
hex: D 6 -> D6
Hexadecimal to binary
Expand each hex digit to its 4-bit pattern and join them:
hex: A 5
binary: 1010 0101 -> 10100101
Hexadecimal to denary
Multiply the left digit by and add the right digit (for a two-digit hex number):
Examples in context
Example 1. Reading a memory dump. A debugger shows a byte as 0x4D. A student converts it through binary: , , so the byte is , which is the ASCII code for the letter M. Going through binary makes the value obvious.
Example 2. Setting a colour by hand. To make a medium grey, a designer wants each of red, green and blue at about half intensity. Half of is roughly , so the colour is #808080. The conversion turns an intensity into a hex pair.
Try this
Q1. Convert to 8-bit binary. [2 marks]
- Cue. .
Q2. Convert to hexadecimal. [2 marks]
- Cue. and , so the answer is .
Q3. Convert to denary. [2 marks]
- Cue. .
Exam-style practice questions
Practice questions written in the style of SEAB exam questions on this dot point, with worked answer explainers. The year tag is the paper they imitate, not the source.
Original5 marks(a) Convert the denary number to 8-bit binary. (b) Convert your binary answer to hexadecimal.Show worked answer →
(a) Use the place values and subtract the largest that fits each time. , then , then , then . So the bits set are :
128 64 32 16 8 4 2 1
1 0 0 1 1 1 0 0
So .
(b) Group the eight bits into nibbles: and . and . So .
Markers reward correct place-value subtraction, the 8-bit answer, and the nibble grouping giving the hex value.
Original4 marks(a) Convert the hexadecimal number to 8-bit binary. (b) Convert to denary.Show worked answer →
(a) Expand each hex digit to its 4-bit pattern. and . Joining them gives .
(b) Method one (from hex): . Method two (from the binary): place values are set, . Both agree.
Markers reward each hex digit expanded to four bits, and the denary value from either route.
Related dot points
- Explain why computers use binary, describe place value in binary and hexadecimal, and state why hexadecimal is used as shorthand for binary
A focused answer to the O-Level Computing point on number systems. Why computers use binary, place value in binary and hexadecimal, the meaning of bits and bytes, and why hexadecimal is a compact shorthand for binary.
- Perform binary addition showing carries, and explain overflow when a result exceeds the fixed width of a register
A focused answer to the O-Level Computing point on binary addition. Adding binary numbers column by column with carries, checking the result against denary, and understanding overflow in a fixed-width register.
- Explain how text (ASCII), sound (sampling) and images (pixels and colour depth) are represented as binary in a computer
A focused answer to the O-Level Computing point on representing data. How text uses character codes such as ASCII, how sound is sampled, and how images are stored as pixels with a colour depth, all as binary.
- Use units of storage from bit to terabyte, and explain lossless and lossy compression and why files are compressed
A focused answer to the O-Level Computing point on data measurement. Units from bit and byte up to terabyte, calculating file sizes, and the difference between lossless and lossy compression and why files are compressed.
- Declare and use Python variables, identify the core data types (int, float, str, bool), and convert between them
A focused answer to the O-Level Computing point on Python variables. Assigning variables, the core data types int, float, str and bool, reading input as a string, and converting between types with int(), float() and str().