Decimal to Binary Converter – Free

Type a base-10 whole number and this decimal to binary converter returns its base-2 form. Decimal 45 becomes 101101. Large values convert exactly, with no rounding.

How to use the Decimal to Binary tool

  1. Enter a whole number in the Base-10 number box, for example 45.
  2. Select Convert to change it to base 2.
  3. Read the binary digits in the Result box. The output has no prefix and no leading zeros.
  4. Select Copy to copy the binary string, or select Example to see 45 converted.

How to convert decimal to binary by hand

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

You can check the answer by adding the place values of the ones: 32 + 8 + 4 + 1 = 45.

45 / 2 = 22 remainder 1
22 / 2 = 11 remainder 0
11 / 2 =  5 remainder 1
 5 / 2 =  2 remainder 1
 2 / 2 =  1 remainder 0
 1 / 2 =  0 remainder 1

Read upward: 101101

What the converter accepts

The input is one whole number written with the digits 0 to 9. Spaces around it are trimmed, and leading zeros are fine: 007 converts to 111. An optional minus sign in front is allowed. The following are rejected. For an invalid character, the error message names it.

  • Decimal points, as in 3.14. Only whole numbers are supported.
  • Thousands separators, as in 1,000, and spaces inside the number.
  • A plus sign, exponent notation such as 1e3, or a 0x prefix.
  • More than 4,096 characters, counting the minus sign.

Negative numbers and bit width

A negative input keeps its minus sign: -45 converts to -101101. This is the mathematical base-2 value, not a two's complement bit pattern. Two's complement depends on a word size, and this tool does not assume one. For the 8-bit pattern of -45, convert 45, pad it to 00101101 and run that through the Binary Two's complement Converter, which returns 11010011.

Positive results are not padded either. 5 converts to 101, not 00000101. Add leading zeros yourself when you need a full byte or a 16-bit or 32-bit word.

Large integers convert exactly

Many converters pass the input through a 64-bit floating-point number, which is exact only up to 2^53. Above that, neighboring integers collapse into one value. This tool parses digit by digit into an arbitrary-precision integer, so 9007199254740993, which is 2^53 + 1, converts to a 1, fifty-two zeros and a final 1, with the last bit intact. The largest unsigned 64-bit value, 18446744073709551615, returns sixty-four ones.

Frequently asked questions

What is 45 in binary?

45 in binary is 101101. That is 32 + 8 + 4 + 1. As a full byte it is written 00101101.

How do I convert 255 to binary?

255 is 11111111, eight ones. It is the largest value an unsigned byte can hold. One more, 256, needs a ninth bit and is written 100000000.

Can this tool convert decimal fractions like 0.5?

No. It converts whole numbers only and reports the decimal point as an invalid digit. Fractions need a different method, repeated multiplication by 2, and many of them, such as 0.1, have no finite binary form.

How many bits does a decimal number need?

A positive integer n needs floor(log2(n)) + 1 bits. Numbers up to 255 fit in 8 bits, up to 65,535 in 16 bits and up to 4,294,967,295 in 32 bits. The length of the result string tells you the exact count.

Does the converter return two's complement for negative numbers?

No. It returns a minus sign followed by the binary magnitude, so -10 gives -1010. Two's complement requires choosing a width first, such as 8 or 32 bits.

Is there a size limit on the number?

The input may be up to 4,096 characters long, far beyond any native integer type. The conversion uses exact integer arithmetic, so every digit of the result is correct.

Related tools