Mr Goff logo

Computer Science

Decimal to binary

Use the area below to generate a random number to practice converting numbers decimal to binary.

Example

For our example let's convert the decimal number 113 to it's binary equivalent.

The first step is to draw out a table and fill it in with the column headings for binary. Remember, the column headings in binary start at 1 on the right and double as you move left like below.

128 64 32 16 8 4 2 1
0 1

We start on the left. If the column heading is bigger than our number we put a 0 in that column and carry on.

If the column heading is equal to or smaller than our number we put a 1 in it. Then subtract the column heading from our number such as in this case 113 - 64 = 49

128 64 32 16 8 4 2 1
0 1 1

And we carry on following those same two rules until we have a total of 0, then any remaining columns are 0s

So to continue our example 49 - 32 = 17

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

17-16 = 1

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

1 - 1 = 0

So 113 in binary is 01110001

Decimal to binary practice

Click the button to get a number to convert

128 64 32 16 8 4 2 1



Computer Science Home