curly{bits}

curlybits / Base Converter / Decimal to Binary

Decimal to Binary Converter

Type a decimal number to convert it to binary as you type. The working is shown step by step underneath, so you can check your homework or learn the method. Binary, octal and other bases are shown too.

How it's converted

How to use the Decimal to Binary Converter

  1. Type or paste the decimal number into the first box.
  2. Read the binary result in the second box, and click Copy to copy it.
  3. Scroll to How it works for the step-by-step method.

How to convert decimal to binary

Divide the number by 2 and write down the remainder (0 or 1). Keep dividing the result by 2 until you reach 0. The binary number is the remainders read from the bottom up.

Example: 45 ÷ 2 = 22 r 1, 22 ÷ 2 = 11 r 0, 11 ÷ 2 = 5 r 1, 5 ÷ 2 = 2 r 1, 2 ÷ 2 = 1 r 0, 1 ÷ 2 = 0 r 1. Reading upwards: 101101.

Another way: subtract the biggest power of 2 that fits (32, then 8, 4, 1 for 45) and put a 1 in each of those positions.

Reference table

DecimalBinaryHexOctal
0000000
1000111
2001022
3001133
4010044
5010155
6011066
7011177
81000810
91001911
101010A12
111011B13
121100C14
131101D15
141110E16
151111F17

Frequently asked questions

What is 255 in binary?

11111111: eight 1s. It's the largest number that fits in one byte.

How do I convert a negative number to binary?

Tick Signed (two's complement) and choose a bit width. −1 in 8 bits is 11111111, and −45 is 11010011.

How many bits do I need?

The info line under the boxes shows how many bits and bytes the number needs.