How to Convert Decimal to Binary (and Binary to Decimal) by Hand
Convert decimal to binary with the divide-by-2 method and binary back to decimal with place values. Worked examples, a quick table and an online checker.
The short answer
To convert a decimal number to binary, keep dividing by 2 and write down each remainder; the remainders read from bottom to top are the binary number. For example, 45 in binary is 101101. To go back, multiply each binary digit by its place value (1, 2, 4, 8, 16 and so on from the right) and add them up. You can check every answer with the Number Base Converter, which converts decimal to binary, octal and hexadecimal at once.
How binary place values work
In decimal, each position is worth 10 times the one to its right: ones, tens, hundreds. In binary, each position is worth 2 times the one to its right:
| Position from the right | 8th | 7th | 6th | 5th | 4th | 3rd | 2nd | 1st |
|---|---|---|---|---|---|---|---|---|
| Place value | 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
Each binary digit (bit) is either 0 or 1, meaning that place value is either left out or counted once. That single idea is enough for both directions of conversion.
Method 1: Decimal to binary by dividing by 2
Example: 45 to binary
| Division | Result | Remainder |
|---|---|---|
| 45 ÷ 2 | 22 | 1 |
| 22 ÷ 2 | 11 | 0 |
| 11 ÷ 2 | 5 | 1 |
| 5 ÷ 2 | 2 | 1 |
| 2 ÷ 2 | 1 | 0 |
| 1 ÷ 2 | 0 | 1 |
Reading the remainders from the bottom up gives 101101. So 45 in decimal is 101101 in binary.
Example: 156 to binary
156 ÷ 2 = 78 remainder 0, 78 ÷ 2 = 39 remainder 0, 39 ÷ 2 = 19 remainder 1, 19 ÷ 2 = 9 remainder 1, 9 ÷ 2 = 4 remainder 1, 4 ÷ 2 = 2 remainder 0, 2 ÷ 2 = 1 remainder 0, 1 ÷ 2 = 0 remainder 1.
Bottom to top: 10011100.
The most common mistake is reading the remainders from top to bottom, which would give 00111001 instead. If your answer starts with 0, you have almost certainly read it the wrong way round, because a binary number written without padding always starts with 1.
Method 2: Decimal to binary by subtracting place values
Some people find this faster for numbers under 256.
For 156: 128 fits (1, leaves 28), 64 does not (0), 32 does not (0), 16 fits (1, leaves 12), 8 fits (1, leaves 4), 4 fits (1, leaves 0), 2 does not (0), 1 does not (0). Result: 10011100, the same as Method 1.
Binary to decimal
Write the place values above the digits, starting with 1 on the right, and add the place values wherever there is a 1.
Example: 101101 to decimal
| Place value | 32 | 16 | 8 | 4 | 2 | 1 |
|---|---|---|---|---|---|---|
| Binary digit | 1 | 0 | 1 | 1 | 0 | 1 |
32 + 8 + 4 + 1 = 45.
Example: 11111111 to decimal
128 + 64 + 32 + 16 + 8 + 4 + 2 + 1 = 255. This is the largest number that fits in 8 bits (one byte), which is why 255 appears so often in computing, for example as the maximum value of each colour channel in RGB.
Quick reference table
| Decimal | Binary | Octal | Hexadecimal |
|---|---|---|---|
| 13 | 1101 | 15 | D |
| 45 | 101101 | 55 | 2D |
| 100 | 1100100 | 144 | 64 |
| 156 | 10011100 | 234 | 9C |
| 255 | 11111111 | 377 | FF |
| 1024 | 10000000000 | 2000 | 400 |
| 2026 | 11111101010 | 3752 | 7EA |
Every row was produced with the Number Base Converter.
Checking your answer with the converter
A few limits to keep in mind:
- The converter works with whole numbers. If you type 10.5 as a decimal, the fractional part is dropped and you get the binary for 10.
- For binary input, keep to 16 digits or fewer. Longer binary strings lose precision before conversion and can give a wrong result.
- Type decimal or binary values for input. Letters such as the A to F used in hexadecimal are not read correctly as input, so use decimal or binary as your starting value and read the hex result from the table.
Why the divide-by-2 method works
Each division by 2 asks: is this number even or odd? The remainder answers that for the current lowest bit. Dividing by 2 then shifts everything one place to the right, so the next remainder tells you the next bit. That is why the first remainder is the rightmost digit and you must read the list upwards.
The same method works for any base. To convert decimal to octal, divide by 8 and collect remainders (0 to 7). For hexadecimal, divide by 16 and write remainders 10 to 15 as A to F. For example, 156 ÷ 16 = 9 remainder 12, and 9 ÷ 16 = 0 remainder 9, so 156 is 9C in hex, matching the table.
Practice problems
Try these, then check them with the converter:
Related tools and guides
If you are converting text rather than numbers, letters are first turned into character codes and then into binary; see How to Convert Text to Binary (and Binary Back to Text) and the Binary Code Translator.
Frequently asked questions
How do you convert decimal to binary?
Divide the number by 2 repeatedly, writing down each remainder, until the result is 0. Read the remainders from the last to the first. For example, 45 gives remainders 1, 0, 1, 1, 0, 1, which read upwards is 101101.
How do you convert binary to decimal?
Write place values 1, 2, 4, 8, 16 and so on from the right, then add the place values where the binary digit is 1. For 101101 that is 32 + 8 + 4 + 1 = 45.
What is 255 in binary?
255 is 11111111, eight 1s. It is the largest value that fits in one byte.
Can the Number Base Converter handle decimals like 10.5?
No. It converts whole numbers only; the fractional part of a decimal input is dropped. Binary input should be 16 digits or fewer.
Put this guide into practice with our free online tool — no signup required.
Open tool