Skip to main content
Data / Number / Computer Science Tools

Decimal to Binary Converter

Convert a decimal number to its exact binary representation, with the conversion steps shown.

Enter a decimal number below - this tool converts it to binary exactly, and can show the repeated-division steps used.

For the reverse direction, see the Binary to Decimal Converter - or the Number Base Converter for other bases.

How Decimal-to-Binary Conversion Works

The classic method repeatedly divides the number by 2, recording each remainder (0 or 1) - reading the remainders from last to first gives the binary representation.

How to Use It

  1. Enter a non-negative integer.
  2. The binary equivalent appears instantly, with the conversion steps available to review.

Limitations

This handles arbitrarily large integers accurately using BigInt - negative numbers aren't converted here, since binary representation of negatives (two's complement) depends on a chosen bit width, which the Bit Shift/Bitwise tools address more directly.

Worked Example

Convert 45 to binary by dividing by 2 and writing down each remainder:

DivisionQuotientRemainder
45 ÷ 2221
22 ÷ 2110
11 ÷ 251
5 ÷ 221
2 ÷ 210
1 ÷ 201

Read the remainders from bottom to top: 101101.

A Quicker Mental Method

Subtract the largest power of 2 that fits, and repeat: 45 - 32 = 13, 13 - 8 = 5, 5 - 4 = 1, 1 - 1 = 0. The powers you used (32, 8, 4, 1) are the 1-bits: 101101.

Common Values

DecimalBinary
101010
1001100100
25511111111
10001111101000

Check a result with Binary to Decimal. For hexadecimal, use Decimal to Hex; to see how many bytes a number of bits is, try the Bits to Bytes Converter.

Frequently Asked Questions

Divide by 2 repeatedly and write down the remainders, then read them from last to first. 13 gives remainders 1, 0, 1, 1, so 13 = 1101.

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

Their binary form (two's complement) depends on the chosen bit width, such as 8, 16 or 32 bits. The bitwise and bit shift tools show signed binary values.
Share this tool: