Decimal to Binary Converter

This free online decimal to binary converter instantly translates any whole decimal (base-10) number into its binary (base-2) equivalent. Enter a non-negative whole number below to see the converted result right away.


How to Use the Decimal to Binary Converter

  1. Type a whole, non-negative decimal number (such as 42) into the "Decimal Number" field.
  2. Click "Convert" to see the equivalent binary value.
  3. If you enter an invalid character, correct the input and convert again.

Method 1: Repeated Division by 2

Divide the number by 2 and write down the remainder, which is always 0 or 1. Divide the quotient by 2 again, and keep going until the quotient is 0. The remainders read from bottom to top are the binary number. Here is 156:

DivisionQuotientRemainder
156 ÷ 2780
78 ÷ 2390
39 ÷ 2191
19 ÷ 291
9 ÷ 241
4 ÷ 220
2 ÷ 210
1 ÷ 201

Reading the remainder column upwards gives 10011100, which matches the converter's output for 156. The first remainder is the rightmost bit, so reversing the order is the step most often forgotten.

Method 2: Subtracting Powers of 2

List the powers of 2 (128, 64, 32, 16, 8, 4, 2, 1). Starting from the largest one that fits, subtract it and write a 1 in that place; write a 0 for any power that does not fit. For 156: 156 − 128 = 28, 64 and 32 do not fit, 28 − 16 = 12, 12 − 8 = 4, 4 − 4 = 0, and 2 and 1 are not needed. The places give 1 0 0 1 1 1 0 0, the same 10011100. This method is quicker in your head for numbers up to a few hundred.

How Many Bits a Number Needs

DecimalBits in binary result
1007
2558
1,00010
1,00,00017
10,00,00020

A rule of thumb: every three decimal digits need about ten bits, because 2 to the power 10 is 1,024, just over 1,000.

Negative Numbers and Fractions by Hand

The converter accepts whole numbers of zero or more. Computers usually store negative integers in two's complement. To find −54 as an 8-bit value, convert 54 to get 110110, pad it to 00110110, flip every bit to 11001001, then add 1 to get 11001010. A shortcut gives the same answer: convert 256 − 54 = 202 with this tool.

For a fractional part, multiply it by 2 repeatedly and take the whole-number digit each time. For 0.625: 1.25 gives 1, 0.5 gives 0, and 1.0 gives 1, so 0.625 is 0.101 in binary. Some fractions never end: 0.1 becomes 0.000110011 with the 0011 repeating forever, which is why 0.1 + 0.2 is not exactly 0.3 in most programming languages.

Very large inputs have a limit too. Numbers up to 9007199254740991 (2 to the power 53, minus 1) convert exactly. Above that, the browser rounds the number before converting, so the last bits of the result may be wrong.

Frequently Asked Questions

The tool repeatedly divides your decimal number by 2 and records the remainders; reading those remainders in reverse gives the binary (base-2) equivalent.

42 in decimal equals 101010 in binary. Try it yourself by entering 42 above.

This tool accepts non-negative whole numbers only (digits 0-9). Negative numbers and fractional values are not supported.

The converter returns the shortest form, without leading zeros, so 5 gives 101. Add zeros on the left until you have eight digits: 00000101. Any number from 0 to 255 fits in one byte; larger numbers need 16 or more bits.

9007199254740991, which is 53 ones in binary. Larger values are accepted, but the browser stores them with limited precision, so they are rounded before conversion and the trailing bits may not match the true value.
No ratings yet — be the first!
Rate this calculator:
Was this tool helpful?