CS01-02 Computer Science Watch
Denary to binary and back
Subscribe on YouTubeLike this lesson on YouTube
In this lesson
In this video you'll learn about denary to binary and back for GCSE Computer Science.
By the end: Convert between denary and 8-bit binary in both directions for values 0 to 255, and work out how many different values a given number of bits can represent.
What it covers
- 0:54 Denary to binary and back
- 3:24 Binary to denary, 11010110
- 4:53 Denary to binary, 173
- 6:52 Your turn: leading zeros, convert 9
- 8:33 How many values
- 10:29 Exam technique
Key words
About this video
GCSE Computer Science - Denary to binary and back | Binary and number bases 2/9 (2026/27 exams)
In this video you'll learn about denary to binary and back for GCSE Computer Science.
Video code: CS01-02 - search YouTube for "ScholaFly CS01-02" to come straight back to this video.
Videos in this chapter:
CS01-00 — Binary and number bases - Intro
CS01-01 — Why computers use binary
CS01-02 — Denary to binary and back
CS01-03 — Why hexadecimal exists
CS01-04 — Denary and hexadecimal
CS01-05 — Binary and hexadecimal
CS01-06 — Binary addition
CS01-07 — Overflow
CS01-08 — Binary shifts
CS01-09 — Negative numbers and two's complement
#DenaryToBinaryAndBack #GCSEComputerScience #ComputerScience
For more, visit ScholaFly: https://scholafly.com
Read the transcript
Picture a row of eight light switches on a wall. Each one is either up or down, and every pattern of ups and downs means something different to the machine behind them. Those eight switches can make exactly two hundred and fifty six different patterns. Not two hundred and fifty five. Get that count wrong inside a program and it runs perfectly until the very last item, then falls over.
This is video two of nine in Binary and number bases. If today feels shaky, C S oh one, oh one, Why computers use binary, covers the step just before this one.
Everything in this topic runs off one short row of numbers, so we build that row first, and build it properly. In ordinary numbers each column to the left is worth ten times the one before. Binary has only two digits, so each column to the left is worth twice the one before. You start at the right-hand end with one, and you double your way left. One, two, four, eight, sixteen, thirty-two, sixty-four, one hundred and twenty-eight. Two checks, every single time. Count the columns: there must be eight. Then read the far-left one: it has to say one hundred and twenty-eight. If either check fails, you doubled wrong somewhere, and every answer built on that row is wrong too. So here is your handle for this whole topic: double from one, and stop at one hundred and twenty-eight. That left-hand column is called the most significant bit, because it carries the most value. The right-hand column, worth one, is the least significant bit. Three headers are on screen, written by three different students. Only one is safe to convert with. Look at A, B and C, and decide which one that is. Take your pick. I'll wait. It is A. B has a twenty-four slipped in between thirty-two and sixteen, which is a doubling mistake. C has the row running the wrong way, with one on the left. The column count catches B, because that slipped-in twenty-four makes nine columns instead of eight. The far-left check catches C, whose left-hand end reads one. Two checks, a couple of seconds, and both mistakes are gone.
Reading a pattern back into an ordinary number comes first, because it is the gentler of the two directions. Here is the pattern: one, one, zero, one, zero, one, one, zero. Line it up underneath the header so that every digit sits in its own column. A one means you take that column's value, and a zero means you leave it out. No column is worth anything other than what the header says. So we take one hundred and twenty-eight, then sixty-four, then sixteen, then four, then two. Add those five values together and you get two hundred and fourteen. The final column holds a zero, so the one is left out. Decide that last column rather than assuming it. Then say what you have actually got, out loud: that pattern of eight bits is the number two hundred and fourteen. Line it up, add the columns holding a one, and the whole conversion is done in a single pass.
Going the other way, from an ordinary number into binary, takes subtraction, and it works along the header from the left. There is a reason it works so cleanly. One hundred and twenty-eight is bigger than the other seven columns added together, which come to one hundred and twenty-seven. The same holds all the way down the row, so if a column fits you take it, and you never go back and change your mind. Convert one hundred and seventy-three. One hundred and twenty-eight fits, so that column gets a one, and forty-five is what is left. Sixty-four is bigger than forty-five, so that column gets a zero. Thirty-two fits, and thirteen is left. Sixteen is too big, so that is another zero. Eight fits, leaving five. Four fits, leaving one. Two is too big, so zero. One fits exactly, and the running total is now empty. So one hundred and seventy-three is one, zero, one, zero, one, one, zero, one. Check it the fast way, by adding the columns you took: one hundred and twenty-eight, thirty-two, eight, four and one. That is one hundred and seventy-three. Anything you convert by subtracting can be checked by adding, and that check costs you about ten seconds.
Your turn on the next one, and it is a small number with something sharp hidden inside it. Convert nine into eight-bit binary, and write down every digit of your answer before you start this again. Pause it there and work it out. I'll wait. Nine is eight plus one, so the eight column and the one column each get a one, and everything else is a zero. That gives one, zero, zero, one. But the question asked for eight bits, and that is only four digits. So pad the front with zeros until you have eight: zero, zero, zero, zero, one, zero, zero, one. The value has not moved. Zeros on the front do nothing, the same way that writing zero, zero, nine does not change nine. So make the padding the last step of every conversion. Count your digits out loud, and if the question said eight bits, you hand over eight digits. Both of those patterns mean nine, and only one of them answers the question that was actually asked.
There is a second skill hiding in that same row of numbers, and it is about counting patterns rather than converting them. How many different values can five bits hold, and what is the largest single value out of those? Have a think. I'll wait. Five bits give you thirty-two different values, and the largest of them is thirty-one. Every extra bit doubles the count, because each pattern you already had can now be followed by a zero or by a one. Five bits is two multiplied by itself five times. The largest is thirty-one, not thirty-two, because the counting starts at zero. Thirty-two different values, running from zero up to thirty-one. Same story for the eight switches on the wall. Two hundred and fifty six different patterns, running from zero up to two hundred and fifty five. One thing worth saying once: everything here is unsigned, zero and upwards with no negatives. Negatives get their own method in C S oh one, oh nine, Negative numbers and two's complement. Two to the power of the number of bits gives you the count of patterns, and the largest value is always one less than that.
Time for the exam side of this, and for once it opens on a compliment. Edexcel's report on their twenty twenty-five Principles of Computer Science paper looked at a question asking for an unsigned denary number to be turned into binary, and said this. Candidates showed improved mathematical skills with the majority of candidates being able to convert an unsigned denary integer into binary. So if you followed those two conversions, or you are close to following them, you are already with the majority of students on this one. Where marks do still go is the header itself. O C R reported on a twenty twenty-two question asking for a denary number converted into binary with working shown, and put it like this. Some candidates did not accurately double the binary header numbers each time, including additional numbers such as twenty-four. That is header B from earlier, turning up in a real exam, and counting the columns would have caught it: nine where there should be eight. The other one is the padding. O C R's report on a twenty twenty-three question that asked for an eight-bit answer says this. However, some candidates did not include the required zeros at the start to make the answer an eight-bit binary number as required. That question asked for the working as well as the answer. Your header and your subtractions are the working, so write them on the paper instead of doing them in your head. Right method with a wrong header, or a right answer in too few digits: both of those are fixable in the last ten seconds of the question.
One, two, four, eight, sixteen, thirty-two, sixty-four, one hundred and twenty-eight. That row is basically the whole video, so here is the run through. Binary into an ordinary number: line the pattern up under the header and add every column that is holding a one. Ordinary number into binary: work left to right, take a column whenever it fits, subtract as you go, then add your columns back up to check. Then pad the front with zeros out to the width the question asked for, and count the digits before you hand it over. And the number of patterns is two to the power of the number of bits, with the largest value sitting one below that count.
The chapter's videos are on screen now. A thumbs-up on one is your own marker that you have nailed it and never need to sit through it again. So if this one landed, put a thumbs-up on it. If it did not quite, save the video or the playlist instead, because this often clicks on a second watch a few days later.
Next in the chapter is the video Why hexadecimal exists.
For more, visit scholafly.com, or watch the next video.
Related terms
For: AQA GCSE 8525, Edexcel GCSE 1CP2, OCR GCSE J277
On the specification
For teachers
This GCSE Computer Science lesson teaches denary to binary and back. By the end, students should be able to convert between denary and 8-bit binary in both directions for values 0 to 255, and work out how many different values a given number of bits can represent. It works through four worked examples and the mistakes examiners report.