Tools
Log in
English

All converters

Decimal to binary

Turn decimal numbers into binary, padded to 8, 16, 32 or 64 bits when you want.

Result

Binary
Decimal
Hex
Octal

Settings

To turn a decimal number into binary, divide by 2 until you reach 0 and read the remainders backwards. Type 13 or 1000 and the bits appear immediately, spaced in fours or eights if you like, with the same value in hex and octal. It costs nothing and asks for no login.

How to do it by hand

  1. Divide the number by 2. The remainder is either 0 or 1.
  2. Divide the quotient by 2 again and write down the new remainder.
  3. Stop once the quotient is 0.
  4. Read the remainders from the bottom up to get the bits.
  5. Another route: subtract the largest power of 2 that fits, put a 1 in that place, and repeat with what is left.

Worked examples

13

13 → 6 r 1, 6 → 3 r 0, 3 → 1 r 1, 1 → 0 r 1

1101

100

64 + 32 + 4

1100100

1000

512 + 256 + 128 + 64 + 32 + 8

1111101000

Common mistakes

  • Reading the remainders top to bottom, which writes the bits backwards.
  • Expecting eight digits for small numbers. 5 is just 101; turn on zero padding to see 00000101.
  • Writing negatives with a minus sign when the data is a byte. In 8 bits, -5 is stored as 11111011.

Binary for 0 to 20

DecimalBinaryBits needed
001
111
2102
3112
41003
51013
61103
71113
810004
910014
1010104
1110114
1211004
1311014
1411104
1511114
16100005
17100015
18100105
19100115
20101005

Questions people ask

How many bits does a number need?

Find the smallest power of 2 above it. 1000 is below 1024, which is 2 to the 10th, so it fits in 10 bits.

Can I convert a whole list at once?

Yes. Put one number per line, or split them with commas or spaces, and each one gets its own row.

Why does 0.1 never end in binary?

0.1 is 1/10, and the factor 5 in 10 cannot be built from powers of 2. The fraction mode writes it as 0.0(0011), where the part in brackets repeats.