Converting decimal to binary is a core skill for anyone learning how computers store numbers. Type a number into the converter directly below to see it instantly, or read on for two reliable hand methods, a full reference table and five worked examples, every one checked on a base-N calculator.
Try it: instant decimal to binary converter
Type any whole number below. Binary, octal and hex update as you type. No submit button, nothing leaves your browser.
.........On this page
Place values
Each binary digit is a power of two, doubling from right to left:
... 64 32 16 8 4 2 1
A binary number is just the sum of the place values where a 1 sits. So 1101 = 8 + 4 + 0 + 1 = 13. Try 8 + 4 + 1
The divide-by-2 method
Divide repeatedly by 2 and record remainders; read them bottom-to-top.
13 ÷ 2 = 6 r 1
6 ÷ 2 = 3 r 0
3 ÷ 2 = 1 r 1
1 ÷ 2 = 0 r 1
read up → 1101
13 (decimal) = 1101 (binary). Check: 8 + 4 + 1 = 13. Try 8 + 4 + 1
25 → remainders 1,0,0,1,1 → 11001 = 16 + 8 + 1 = 25. Try 16 + 8 + 1
Four more conversions, worked in full with every remainder shown, are in Solved examples next.
Solved examples
Four more conversions, each worked in full with the divide-by-2 method. Every remainder is shown, and every answer is checked by summing place values.
45 in binary
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
read up → 101101
45 = 101101 (binary) = 2D (hex). Check: 32 + 8 + 4 + 1 = 45. Try 32 + 8 + 4 + 1
100 in binary
100 ÷ 2 = 50 r 0
50 ÷ 2 = 25 r 0
25 ÷ 2 = 12 r 1
12 ÷ 2 = 6 r 0
6 ÷ 2 = 3 r 0
3 ÷ 2 = 1 r 1
1 ÷ 2 = 0 r 1
read up → 1100100
100 = 1100100 (binary) = 64 (hex). Check: 64 + 32 + 4 = 100. Try 64 + 32 + 4
255 in binary
255 ÷ 2 = 127 r 1
127 ÷ 2 = 63 r 1
63 ÷ 2 = 31 r 1
31 ÷ 2 = 15 r 1
15 ÷ 2 = 7 r 1
7 ÷ 2 = 3 r 1
3 ÷ 2 = 1 r 1
1 ÷ 2 = 0 r 1
read up → 11111111
255 = 11111111 (binary), eight 1s, the largest value a single byte holds. Check: 128 + 64 + 32 + 16 + 8 + 4 + 2 + 1 = 255. Try the full sum
1024 in binary
1024 ÷ 2 = 512 r 0
512 ÷ 2 = 256 r 0
256 ÷ 2 = 128 r 0
128 ÷ 2 = 64 r 0
64 ÷ 2 = 32 r 0
32 ÷ 2 = 16 r 0
16 ÷ 2 = 8 r 0
8 ÷ 2 = 4 r 0
4 ÷ 2 = 2 r 0
2 ÷ 2 = 1 r 0
1 ÷ 2 = 0 r 1
read up → 10000000000
1024 = 10000000000 (binary): a single 1 followed by ten 0s, since 1024 is exactly 210. Try 2^10
The subtract-powers method
Take the largest power of two that fits, subtract, repeat:
255 − 128 = 127 → bit 128 = 1
127 − 64 = 63 → bit 64 = 1 … and so on
result: 11111111
255 = 11111111 (eight 1s). This matches the divide-by-2 result for 255 in Solved examples above: two different roads to the same eight 1s.
Decimal to binary table
Every value from 0 to 32, generated straight from JavaScript's own base conversion so there is no hand-typed row to get wrong.
| Decimal | Binary | Hex |
|---|---|---|
| 0 | 0 | 0 |
| 1 | 1 | 1 |
| 2 | 10 | 2 |
| 3 | 11 | 3 |
| 4 | 100 | 4 |
| 5 | 101 | 5 |
| 6 | 110 | 6 |
| 7 | 111 | 7 |
| 8 | 1000 | 8 |
| 9 | 1001 | 9 |
| 10 | 1010 | A |
| 11 | 1011 | B |
| 12 | 1100 | C |
| 13 | 1101 | D |
| 14 | 1110 | E |
| 15 | 1111 | F |
| 16 | 10000 | 10 |
| 17 | 10001 | 11 |
| 18 | 10010 | 12 |
| 19 | 10011 | 13 |
| 20 | 10100 | 14 |
| 21 | 10101 | 15 |
| 22 | 10110 | 16 |
| 23 | 10111 | 17 |
| 24 | 11000 | 18 |
| 25 | 11001 | 19 |
| 26 | 11010 | 1A |
| 27 | 11011 | 1B |
| 28 | 11100 | 1C |
| 29 | 11101 | 1D |
| 30 | 11110 | 1E |
| 31 | 11111 | 1F |
| 32 | 100000 | 20 |
Powers of two, 20 to 210
Each step doubles the last. Learn these by sight and most conversions become recognition instead of arithmetic.
| Power | Decimal | Binary |
|---|---|---|
| 20 | 1 | 1 |
| 21 | 2 | 10 |
| 22 | 4 | 100 |
| 23 | 8 | 1000 |
| 24 | 16 | 10000 |
| 25 | 32 | 100000 |
| 26 | 64 | 1000000 |
| 27 | 128 | 10000000 |
| 28 | 256 | 100000000 |
| 29 | 512 | 1000000000 |
| 210 | 1024 | 10000000000 |
One more value worth knowing by sight, even though it is not itself a power of two: 255 = 11111111, one less than 28 and the largest value a single byte holds. It is worked in full, divide-by-2 style, in Solved examples above.
Converting binary back to decimal
The reverse direction uses the same place values and no dividing at all. Write the powers of two under each bit, then add the columns that hold a 1.
place value: 16 8 4 2 1
binary 11010: 1 1 0 1 0
11010 (binary) = 26 (decimal). Check: 16 + 8 + 2 = 26. Try 16 + 8 + 2
This is the same table as place values above, just read from bits to a number instead of from a number to bits.
Straight to hex
Group the binary digits into fours from the right and convert each group:
1111 1111 → F F → FF
That four-bit grouping is why hexadecimal is so popular with programmers, see the binary, octal & hex calculator pillar guide.
Common mistakes
The divide-by-2 method produces remainders top to bottom, but the answer reads bottom to top. Take 13's remainders in the order they appear, 1, 0, 1, 1, and you get 1011, which is 11, not 13. Reverse them to 1, 1, 0, 1 and you get the correct 1101. Try 8 + 2 + 1 to see where the wrong order lands.
Stop dividing only when the quotient reaches 0, not before. Stopping one step early on 13, after the quotient hits 1 but without dividing that 1 by 2, drops the last remainder and leaves 101, which is 5. That final division, 1 ÷ 2 = 0 r 1, supplies the leading bit and is easy to skip because the quotient already looks done.
Divide-by-2 with remainders converts the integer part only. A value like 13.5 is not solved by dividing 13.5 itself: the whole-number part (13) uses this method, and the fractional part (0.5) needs a different one, repeatedly multiplying by 2 and reading off the integer part each time. The converter above and this guide both cover whole numbers from 0 up, not fractions.
On the calculator
The converter near the top of this page handles the lookup without leaving the article. The calculator itself adds negative numbers and bitwise logic.
Switch to BASE-N mode, enter 13 in DEC, then select BIN to read 1101 (or HEX for D). It's the fastest way to check any conversion. Negative values use two's complement, see the two's complement walkthrough.
Frequently asked questions
How do I convert decimal to binary?
Divide by 2 repeatedly and read the remainders bottom-to-top. For 13 that gives 1101. The converter above does this instantly for any whole number up to 9,007,199,254,740,991.
How do I convert binary to hex?
Group the bits into fours from the right and convert each group on its own; 1111 1111 becomes FF.
What are the binary place values?
Powers of two (1, 2, 4, 8, 16, 32 and so on) and you sum the ones that have a 1.
What is 10 in binary?
1010. Ten is eight plus two, so bits 8 and 2 are set: 1000 plus 10 makes 1010. Check it in the table above or type 10 into the converter.
How do you convert decimal to binary quickly?
For small numbers, subtract the largest power of two that fits, mark a 1, and repeat, the method in the subtract-powers section above. For anything larger, or for zero chance of a slip, use the converter at the top of this page or switch the calculator to BASE-N mode.
How do you convert decimal to binary or hex on a calculator?
Press MODE, choose BASE-N, type the number while DEC is selected, then press BIN for binary or HEX for hexadecimal. OCT works the same way.
Is a decimal fraction converted the same way as a whole number?
No. Divide-by-2 with remainders converts the integer part only. A fraction like 0.5 is converted by repeatedly multiplying by 2 and taking the integer part of each result, a different method not covered in this guide, which handles whole numbers from 0 up.
What is the largest number the converter above handles exactly?
9,007,199,254,740,991, which is 2 to the power 53 minus 1. That is the largest whole number plain JavaScript math represents without rounding, so the converter uses BigInt and refuses anything larger rather than risk a wrong digit.
Check any conversion
Enter a number in BASE-N mode and switch bases to see binary, octal and hex.
Convert 255d in BASE-N mode →After pressing =, press the Bin key to view the binary representation.