Skip to content
BinaryTo

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

Width

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.

How to convert decimal to binary by hand
DivideQuotientRemainder
25 ÷ 2121
12 ÷ 260
6 ÷ 230
3 ÷ 211
1 ÷ 201

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.

The digits 0 to 9 as text characters
CharacterBinaryDecimalHex
0001100004830
1001100014931
2001100105032
3001100115133
4001101005234
5001101015335
6001101105436
7001101115537
8001110005638
9001110015739

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.