Decimal to Binary Converter
Type a whole number to get it in binary. The division table under the result shows every step, so you can check your own working.
Decimal to binary
How to convert decimal to binary by hand
Divide the number by 2 and write down the remainder, 0 or 1. Keep dividing the quotient by 2 until it reaches 0. The remainders read from the last one to the first are the binary number. Here is 25.
| Divide | Quotient | Remainder |
|---|---|---|
| 25 ÷ 2 | 12 | 1 |
| 12 ÷ 2 | 6 | 0 |
| 6 ÷ 2 | 3 | 0 |
| 3 ÷ 2 | 1 | 1 |
| 1 ÷ 2 | 0 | 1 |
Read the remainders from bottom to top: 11001
Bit width and negative numbers
With Width on Auto, you get the shortest binary, so 25 is 11001. Choose 8, 16 or 32 bits to pad it with leading zeros, the way a computer stores it in a byte or a word: 25 in 8 bits is 00011001.
Negative numbers come out in two's complement, the form computers use. In 8 bits, -1 is 11111111 and -5 is 11111011. If a number doesn't fit the width you chose, the converter says so instead of cutting off bits.
The converter takes whole numbers only. To read binary back into decimal, use the binary to decimal converter.
The digits 0 to 9 as text characters
Careful: the number 5 is 101 in binary, but the character "5" in a text file is ASCII code 53. If you want the binary a keyboard character uses, use the text to binary converter.
| Character | Binary | Decimal | Hex |
|---|---|---|---|
| 0 | 00110000 | 48 | 30 |
| 1 | 00110001 | 49 | 31 |
| 2 | 00110010 | 50 | 32 |
| 3 | 00110011 | 51 | 33 |
| 4 | 00110100 | 52 | 34 |
| 5 | 00110101 | 53 | 35 |
| 6 | 00110110 | 54 | 36 |
| 7 | 00110111 | 55 | 37 |
| 8 | 00111000 | 56 | 38 |
| 9 | 00111001 | 57 | 39 |
Frequently asked questions
How do you convert 25 to binary?
Divide by 2 and keep the remainders: 25 gives 1, 12 gives 0, 6 gives 0, 3 gives 1 and 1 gives 1. Read them from the bottom up: 25 is `11001`.
What is 255 in binary?
255 is `11111111`, eight 1s. It is the largest number that fits in one byte.
How do you convert negative numbers to binary?
Computers use two's complement: write the positive number in binary at a fixed width, flip every bit, then add 1. For -5 in 8 bits, 5 is `00000101`, flipped is `11111010`, plus 1 is `11111011`. Type a negative number above and the converter does this for you.