DevSwitch.net
Back to Tools
#

Decimal to Binary Converter

Convert decimal numbers to binary format

Number Converters

Tip: Enter a decimal number (0-9 only). The conversion happens in real-time.

Runs in your browser

Decimal Binary

Binary base 2
-
Try

Convert decimal to binary

Type a decimal number and its binary form appears as you type, split into groups of four bits so long values are easy to read, with the bit length in the window bar. Copy takes the plain digits.

The binary converter works on whole numbers of any size: 18446744073709551615 becomes sixty-four ones, exactly. Many converters round anything above 9007199254740991, the largest whole number a JavaScript number holds, and print the wrong bits without saying so.

How to convert decimal to binary by hand

Divide by 2 and write down the remainder, until nothing is left. The remainders, read from the last to the first, are the binary number. For 156:

StepRemainder
156 ÷ 2 = 78 0
78 ÷ 2 = 39 0
39 ÷ 2 = 19 1
19 ÷ 2 = 9 1
9 ÷ 2 = 4 1
4 ÷ 2 = 2 0
2 ÷ 2 = 1 0
1 ÷ 2 = 0 1

Read upwards: 156 is 10011100 in binary. To check it, add the place values of the ones: 128 + 16 + 8 + 4 = 156. The step-by-step window above does the same division for whatever number you type.

Decimal to binary table

DecimalBinaryBits
1 1 1
2 10 2
5 101 3
10 1010 4
16 10000 5
100 1100100 7
127 1111111 7
255 11111111 8
256 100000000 9
1000 1111101000 10
1024 10000000000 11
65535 1111111111111111 16

Powers of two are a one followed by zeros, and one less than a power of two is all ones: that is why 255 fills a byte and 65535 fills sixteen bits.

Going the other way?

The binary to decimal converter adds up the place values of each bit and shows the sum.

Negative numbers and leading zeros

What you get

  • -5 becomes -101: the minus sign stays, the digits are the size of the number
  • The shortest binary form, with no leading zeros: 5 is 101, not 00000101
  • Spaces, underscores and thousands separators in the input are ignored, so 1_000_000 works

Not done

  • Two's complement: in an 8-bit signed byte -5 is 11111011, which this converter does not write
  • Padding to 8, 16 or 32 bits: add the zeros on the left yourself
  • Fractions: 0.1 has no exact binary form and is not converted

To see the same number in hex and octal at the same time, use the number system converter; for hex alone, the decimal to hex converter.

Decimal to binary questions

1010: one eight, no four, one two, no one. 8 + 2 = 10.

As many as the length of its binary form, shown in the window bar as it changes. A number below 256 fits in 8 bits, below 65536 in 16 bits, below 4294967296 in 32 bits.

Leading zeros don't change a number, so the converter leaves them out, like 0042 is just 42. Add zeros on the left if you need a fixed width such as a full byte.

Yes. It uses exact whole-number arithmetic, so a 30-digit number converts without rounding. The step-by-step window shows the first 40 divisions.

No. The conversion runs in your browser.