Number system converter
Convert between binary, octal, decimal, hexadecimal and BCD. Type in any box and the others update straight away, with the working shown step by step.
Type in any box. The other four change as you type, and the working appears underneath.
The working
Type a number in any box to see how to convert it by hand, one step at a time.
The four number systems
Every number system has a base: how many different digits it uses.
- Binary (base 2) uses 0 and 1. It is the language computers work in.
- Octal (base 8) uses 0 to 7.
- Decimal (base 10) uses 0 to 9. It is the one we use every day.
- Hexadecimal (base 16) uses 0 to 9, then A to F for 10 to 15.
Why is it the same number?
10102, 128, 1010 and A16 all mean ten. Only the way it is written changes. The small number after it tells you which base it is written in.
Hexadecimal is popular with programmers because one hex digit is exactly four binary digits, so 1111 11112 is simply FF16.
How to convert by hand
In an exam you have to show your steps. The tool writes them out for the number you type, using these methods.
| Conversion | Method |
|---|---|
| Decimal to binary, octal or hexadecimal | Divide by 2, 8 or 16 again and again until the quotient is 0. Read the remainders from the bottom to the top. |
| Binary, octal or hexadecimal to decimal | Multiply each digit by its place value (a power of 2, 8 or 16) and add the results. |
| Binary to octal, and back | One octal digit is three bits. Group the bits in threes from the right, or write each octal digit as three bits. |
| Binary to hexadecimal, and back | One hexadecimal digit is four bits. Group the bits in fours from the right, or write each hexadecimal digit as four bits. |
| Octal to hexadecimal, and back | Go through binary: change the number to bits first, then group the bits again. |
| Decimal to BCD, and back | Write each decimal digit as its own group of four bits. |
What is BCD?
BCD stands for Binary Coded Decimal. It writes each decimal digit as its own group of four bits. So 5310 is 0101 0011 in BCD: 0101 for the 5 and 0011 for the 3.
BCD is not the same as binary. As one binary number, 53 is 1101012. BCD codes the digits one at a time; binary converts the whole number.
A decimal digit is never more than 9, so only the ten groups from 0000 to 1001 are BCD codes. The six groups from 1010 to 1111 are not valid, and the tool tells you when you type one.
More to try
- Convert
35B16 to octal on paper, then check your steps against the tool. - Write 69 in BCD and in binary. Which one is longer, and why?
- Which of these are valid BCD codes:
1001,1110,0111,1010? - Type
1000in the binary, octal, decimal and hexadecimal boxes in turn. Which one is the biggest number?