Decimal to binary converter

To convert decimal to binary, divide the number by 2 again and again and read the remainders from last to first. So 13 becomes 1101. Type any whole number below to get its binary digits exactly, from 0 to values far past 64 bits. The conversion runs in your browser.

Input number

Enter a whole number and choose the bases.

Enter a whole number, choose the bases, then convert.

Allowed digits depend on your input base.

Swap uses the result as your next input when one is available.

Whole numbers only. Enter digits without prefixes or separators: FF, not 0xFF. Surrounding whitespace is ignored.

Converted number

The same integer in your chosen base.

Exact whole-number conversion

Decimal to binary conversion table

Each binary value comes from the converter itself. The results have no leading zeros.
DecimalBinary
00
11
210
311
4100
5101
81000
101010
1610000
2511001
32100000
641000000
1001100100
12810000000
22411100000
25511111111
256100000000
10001111101000
102410000000000

The number of binary digits grows by one at every power of 2. 127 still fits in 7 bits, 128 needs 8, and 256 needs 9. So 255 is the largest number that fits in one byte, and 1024 is the first number with 11 bits.

Every row with a single 1 is a power of 2, and its zeros count the doublings. 64 is 1 followed by six zeros, because 64 is 2 to the power 6. Adding 1 to a run of 1s, as from 255 to 256, carries all the way to a new digit.

How to convert decimal to binary

Divide the number by 2 and write down the remainder, which is always 0 or 1. Divide the quotient by 2 again and repeat until the quotient reaches 0. The remainders, read from the last to the first, are the binary digits.

For 25: 25 ÷ 2 is 12 remainder 1, 12 ÷ 2 is 6 remainder 0, and 6 ÷ 2 is 3 remainder 0. Then 3 ÷ 2 is 1 remainder 1, and 1 ÷ 2 is 0 remainder 1. Read from the bottom, the remainders give 11001.

The other hand method subtracts powers of 2. 224 holds 128, leaving 96, which holds 64, leaving 32, which is itself a power. The bits for 128, 64 and 32 are 1 and the five lower bits are 0, so 224 is 11100000. The converter does neither by hand: it forms the exact value and writes it in base 2.

Using the decimal to binary converter

The page opens with Decimal (10) in From base and Binary (2) in To base. Type the number in the Number field and select Convert number. The bits appear in the Converted number panel, and Copy result or Download TXT keeps them.

The result never starts with a zero, so 5 gives 101, not 00000101. When you need a fixed width, such as a byte, add zeros on the left yourself until you have 8 digits. 13 becomes 1101 here and 00001101 as a byte.

Type the number without commas or spaces: 1,000 is rejected, while 1000 gives 1111101000. A leading plus or minus sign is accepted. Swap bases moves the bits into the Number field and turns the form into binary to decimal, a quick way to check the answer. Reset returns the form to decimal to binary.

Limits

Negative numbers come out with a minus sign, so −5 gives -101 and −255 gives -11111111. That is not how a computer stores a negative integer. For 8-bit two's complement, add 256 to the negative number first: −5 plus 256 is 251, which the converter writes as 11111011.

Fractions are rejected, never rounded, so 0.7 and 0.25 both give an error. A binary fraction needs a different method, repeated multiplication by 2, which the questions below show by hand.

The converter has no digit limit, and values past the 64-bit range stay exact. 65535 gives sixteen 1s, and a number with hundreds of digits converts the same way. It converts numbers only, one at a time, typed in the Number field. To see text as bits, you would need a character encoder, which this page is not.

Questions

How do I convert a decimal to binary?

Divide by 2, note the remainder, and keep dividing the quotient until it reaches 0. Read the remainders from last to first. For 6, the remainders are 0, 1 and 1, so 6 is 110. On this page, type the number and select Convert number to get the bits directly.

What is 224 in binary?

224 in decimal is 11100000 in binary. It is 128 + 64 + 32, so the top three bits of a byte are 1 and the lower five are 0. That pattern is common in network masks, where 224 marks the first three bits of an octet.

What is 25 in binary?

25 in decimal is 11001 in binary. Dividing by 2 gives the remainders 1, 0, 0, 1 and 1, and reading them backwards gives 11001. As a check, 16 + 8 + 1 is 25. Written as a full byte with leading zeros, it is 00011001.

How do I convert 0.7 to binary?

This converter rejects 0.7, because it takes whole numbers only. By hand, multiply the fraction by 2 and keep the whole part each time: 1.4 gives 1, 0.8 gives 0, 1.6 gives 1, 1.2 gives 1 and 0.4 gives 0. The pattern then repeats, so 0.7 is 0.10110 followed by 0110 forever.