How-to Guide 6 min read

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.

decimal to binarybinary to decimalhow to convert decimal to binarydivide by 2 methodbinary place values

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 right8th7th6th5th4th3rd2nd1st
Place value1286432168421

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

  • Divide the number by 2.
  • Write down the remainder (it will always be 0 or 1).
  • Divide the whole-number result by 2 again, and write down the new remainder.
  • Repeat until the result is 0.
  • Read the remainders from the last one to the first one. That is the binary number.
  • Example: 45 to binary

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

    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.

  • Find the largest place value that fits into your number (from 128, 64, 32, 16, 8, 4, 2, 1).
  • Put a 1 in that position and subtract the place value.
  • Move to the next smaller place value. If it fits into what is left, write 1 and subtract; otherwise write 0.
  • Continue down to the 1s place.
  • 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 value32168421
    Binary digit101101

    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

    DecimalBinaryOctalHexadecimal
    13110115D
    45101101552D
    100110010014464
    156100111002349C
    25511111111377FF
    1024100000000002000400
    20261111110101037527EA

    Every row was produced with the Number Base Converter.

    Checking your answer with the converter

  • Open the Number Base Converter.
  • Type your whole number in the Value to convert box and choose Decimal (Base 10) in the From list.
  • The result box shows the unit picked in the To list (Binary by default), and the table underneath shows the same value in decimal, binary, octal and hexadecimal.
  • To check binary to decimal, choose Binary (Base 2) as the From unit and type the binary digits.
  • 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:

  • 13 to binary (answer: 1101)
  • 100 to binary (answer: 1100100)
  • 10011100 to decimal (answer: 156)
  • 2026 to binary (answer: 11111101010)
  • 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.

    Try this tool on Lazyblink

    Put this guide into practice with our free online tool — no signup required.

    Open tool