Screenshot of the free online scientific calculator showing the definite integral ∫(X², 0, 3) = 9 Free online scientific calculator Open the free scientific calculator 8 calculation modes: calculus, matrices, complex numbers, statistics, base-N. No download, no sign-up. Open calculator →
Base-N · How-to

Decimal to Binary Conversion Guide

Type any whole number into the live converter below, or work through it by hand: two methods, a full 0 to 32 table, five solved examples, and the mistakes that trip people up.

WideMathUpdated 28 September 202610 min read

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.

Binary...
Octal...
Hex...

On this page

  1. Try it: converter
  2. Place values
  3. The divide-by-2 method
  4. Solved examples
  5. The subtract-powers method
  6. Decimal to binary table
  7. Binary back to decimal
  8. Straight to hex
  9. Common mistakes
  10. On the calculator
  11. FAQ

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

Another

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.

DecimalBinaryHex
000
111
2102
3113
41004
51015
61106
71117
810008
910019
101010A
111011B
121100C
131101D
141110E
151111F
161000010
171000111
181001012
191001113
201010014
211010115
221011016
231011117
241100018
251100119
26110101A
27110111B
28111001C
29111011D
30111101E
31111111F
3210000020

Powers of two, 20 to 210

Each step doubles the last. Learn these by sight and most conversions become recognition instead of arithmetic.

PowerDecimalBinary
2011
21210
224100
2381000
241610000
2532100000
26641000000
2712810000000
28256100000000
295121000000000
210102410000000000

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

Reading remainders in the wrong order

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.

Forgetting the final 1

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.

Confusing a decimal fraction with an integer

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.

Screenshot of the free online scientific calculator showing the definite integral ∫(X², 0, 3) = 9 Free · No sign-up · Works offline Open the Scientific Calculator A real scientific calculator in your browser, with 8 modes: calculus, matrices, complex numbers, statistics, base-N and equation solving. Open Calculator →