Skip to content

Decimal to Binary Converter - Convert Numbers to Binary

Binary (2)
—
Other bases
Octal (8)—
Decimal (10)—
Hexadecimal (16)—
Base 36—

Turn Any Whole Number Into Binary

Enter a decimal number and its binary form appears at once. Tick "Group digits" to pad the result to whole 4-bit nibbles and split it with spaces, which makes long values much easier to check against a datasheet. The hex and octal equivalents are listed too. Large numbers such as 264 or a database ID with 20 digits convert exactly.

The Divide-by-Two Method

To convert by hand, divide by 2 over and over and keep the remainders. Each remainder is one bit, starting with the least significant bit on the right.

Worked example: 156

Number÷ 2Remainder (bit)
156780
78390
39191
1991
941
420
210
101

Reading the remainders from the bottom up gives 10011100. Check it by adding the place values of the 1 bits: 128 + 16 + 8 + 4 = 156.

An alternative is subtraction: find the largest power of two that fits (128), write a 1 in that position, subtract it (28 left), and repeat with 16, 8 and 4. Positions you skip get a 0.

Decimal to Binary Table

DecimalBinaryGrouped
000000
110001
2100010
3110011
41000100
51010101
61100110
71110111
810001000
910011001
1010101010
1110111011
1211001100
1311011101
1411101110
1511111111
16100000001 0000
17100010001 0001
18100100001 0010
19100110001 0011
20101000001 0100
321000000010 0000
501100100011 0010
6410000000100 0000
10011001000110 0100
12711111110111 1111
128100000001000 0000
200110010001100 1000
255111111111111 1111
2561000000000001 0000 0000
51210000000000010 0000 0000
100011111010000011 1110 1000
1024100000000000100 0000 0000

Bit Width and Leading Zeros

The binary form of a number has no fixed length: 5 is simply 101. Real systems store numbers in fixed widths, so 5 in an 8-bit byte is written 00000101 and in a 16-bit register 0000000000000101. The extra zeros on the left do not change the value. When you compare against documentation that shows full bytes or words, pad the result on the left to the width you need. The grouping option pads to whole nibbles, which lines the result up with hex digits.

To check an answer, add up the place values of each 1 bit, or convert the result back with the binary to decimal page and confirm you get the original number.

Why Developers Convert to Binary

Seeing the bits helps when you build bit masks, set feature flags, check which permissions a number enables, or work out a subnet mask from a prefix length. To read binary back as a number, use the binary to decimal converter. To turn text characters into bits, use the text to binary mode of the hex converter.

Related Tools

Frequently Asked Questions

How do you convert a decimal number to binary?
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 last to first are the binary number. For 13: remainders 1, 0, 1, 1, so 13 is 1101.
How many bits do I need for a number?
A positive number n needs floor(log2(n)) + 1 bits. In practice: up to 255 fits in 8 bits, up to 65535 in 16 bits, and up to 4294967295 in 32 bits. The converter shows the bit count under the results.
How do I write a negative number in binary?
Computers usually use two's complement with a fixed width. For 8 bits, add 256 to the negative number and convert the result: -5 + 256 = 251 = 11111011. This tool shows negative numbers with a minus sign instead, because the correct two's complement depends on the width you need.
Can it convert decimal fractions like 0.1?
No, this converter works with whole numbers only. Fractions such as 0.1 have no exact binary form (it repeats forever), which is why 0.1 + 0.2 is not exactly 0.3 in most programming languages.