Free · No signup · Runs in your browser

Decimal to Binary Converter

Enter a whole number, a negative number or a decimal fraction and get its binary form. Open the steps to see the repeated division by 2.

This tool needs JavaScript. Please enable it in your browser to use it.

  • Instant results as you type
  • Step-by-step working
  • Private: input stays in your browser
  • Free, no signup

To convert decimal to binary, divide the number by 2 repeatedly and note each remainder. Reading the remainders in reverse gives the binary number. For 13 the remainders come out 1, 0, 1, 1, so 13 is 1101 in binary.

How to use the decimal to binary converter

  1. Type a decimal number such as 42, -7 or 10.625.
  2. The binary result updates as you type, with hexadecimal, octal and two’s complement shown for whole numbers.
  3. Open Show the steps for the division table, then copy the result.

Examples

DecimalBinary
5101
101010
42101010
1001100100
25511111111
10001111101000
-5-101 (8-bit two’s complement: 11111011)
10.6251010.101

The division method, step by step

Take 42. Divide by 2, keep the remainder, and repeat with the quotient until you reach 0.

DivisionQuotientRemainder (bit)
42 / 2210
21 / 2101
10 / 250
5 / 221
2 / 210
1 / 201

Read the remainders from the bottom up: 101010. So 42 in binary is 101010.

Fractions in binary

For the part after the decimal point, multiply by 2 and take the whole-number part each time. For 0.625: 0.625 x 2 = 1.25 (bit 1), 0.25 x 2 = 0.5 (bit 0), 0.5 x 2 = 1.0 (bit 1). So 0.625 is .101, and 10.625 is 1010.101. Some fractions, like 0.1, never end in binary; the tool shows 32 bits and says it was rounded down.

Negative numbers

Computers store negative integers in two’s complement: write the positive number in binary, invert every bit, and add 1. For -5 in 8 bits: 00000101 becomes 11111010, plus 1 is 11111011. Enter a negative number above to see the forms, or use the two’s complement calculator.

Decimal 0 to 20 in binary

DecimalBinary
00
11
210
311
4100
5101
6110
7111
81000
91001
101010
111011
121100
131101
141110
151111
1610000
1710001
1810010
1910011
2010100

For the opposite direction, see binary to decimal, or read the full guide: how to convert decimal to binary.

Decimal to binary converter FAQ

What is 10 in binary?

10 in decimal is 1010 in binary (8 + 2).

What is the largest number I can convert?

There is no fixed limit. The tool uses arbitrary-precision integers, so numbers with hundreds of digits convert correctly.

How many bits do I need for a number?

A number n needs floor(log2 n) + 1 bits. For example 255 needs 8 bits and 256 needs 9.

Why does 0.1 not convert exactly?

0.1 is a repeating fraction in binary (0.000110011…), just as 1/3 repeats in decimal. The tool shows 32 bits.

How do I convert back?

Paste the binary into the binary to decimal converter.