Skip to main content
SingaporeComputer ScienceSyllabus dot point

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.

Generated by Claude Opus 4.87 min answer

Reviewed by: AI editorial process; not yet individually human-reviewed

Have a quick question? Jump to the Q&A page

Jump to a section
  1. What this dot point is asking
  2. The answer
  3. Examples in context
  4. Try this

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 128,64,32,16,8,4,2,1128, 64, 32, 16, 8, 4, 2, 1. Put a 11 under the largest power that fits, subtract it from the number, and repeat with the remainder. Put 00 where a power does not fit.

Method 2: repeated division by two. Divide the number by 22, writing the remainder (00 or 11) each time, until you reach 00. 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 11:

101102=16+4+2=2210110_2 = 16 + 4 + 2 = 22

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 1616 and add the right digit (for a two-digit hex number):

3F16=3×16+15=48+15=63\text{3F}_{16} = 3 \times 16 + 15 = 48 + 15 = 63

Examples in context

Example 1. Reading a memory dump. A debugger shows a byte as 0x4D. A student converts it through binary: 4=0100\text{4} = 0100, D=1101\text{D} = 1101, so the byte is 010011012=7701001101_2 = 77, 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 255255 is roughly 128=100000002=8016128 = 10000000_2 = \text{80}_{16}, so the colour is #808080. The conversion turns an intensity into a hex pair.

Try this

Q1. Convert 8989 to 8-bit binary. [2 marks]

  • Cue. 89=64+16+8+1=01011001289 = 64 + 16 + 8 + 1 = 01011001_2.

Q2. Convert 11110010211110010_2 to hexadecimal. [2 marks]

  • Cue. 1111=F1111 = \text{F} and 0010=20010 = 2, so the answer is F216\text{F2}_{16}.

Q3. Convert 6A16\text{6A}_{16} to denary. [2 marks]

  • Cue. 6×16+10=96+10=1066 \times 16 + 10 = 96 + 10 = 106.

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 156156 to 8-bit binary. (b) Convert your binary answer to hexadecimal.
Show worked answer →

(a) Use the place values 128,64,32,16,8,4,2,1128, 64, 32, 16, 8, 4, 2, 1 and subtract the largest that fits each time. 156−128=28156 - 128 = 28, then 28−16=1228 - 16 = 12, then 12−8=412 - 8 = 4, then 4−4=04 - 4 = 0. So the bits set are 128,16,8,4128, 16, 8, 4:

128  64  32  16   8   4   2   1
  1   0   0   1   1   1   0   0

So 156=100111002156 = 10011100_2.

(b) Group the eight bits into nibbles: 10011001 and 11001100. 10012=91001_2 = 9 and 11002=12=C1100_2 = 12 = \text{C}. So 156=9C16156 = \text{9C}_{16}.

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 B716\text{B7}_{16} to 8-bit binary. (b) Convert B716\text{B7}_{16} to denary.
Show worked answer →

(a) Expand each hex digit to its 4-bit pattern. B=11=10112\text{B} = 11 = 1011_2 and 7=011127 = 0111_2. Joining them gives B716=101101112\text{B7}_{16} = 10110111_2.

(b) Method one (from hex): B×16+7=11×16+7=176+7=183\text{B} \times 16 + 7 = 11 \times 16 + 7 = 176 + 7 = 183. Method two (from the binary): place values 128,32,16,4,2,1128, 32, 16, 4, 2, 1 are set, 128+32+16+4+2+1=183128 + 32 + 16 + 4 + 2 + 1 = 183. Both agree.

Markers reward each hex digit expanded to four bits, and the denary value 183183 from either route.

Related dot points