Decimal to Binary
Convert a decimal number to binary by dividing by 2 and reading remainders.
Formula
Variables
Example
13 = 1101₂
How it works
Binary is a place-value system with only two digits, 0 and 1, so every decimal number must be rewritten as a sum of powers of 2. Repeated division by 2 works because each division step separates the number into a quotient and a remainder: the remainder tells you whether the current power of 2 is needed (1) or not (0). Reading the remainders from bottom to top gives the binary digits in the correct order.
When to use it
Use this when converting a whole number from base 10 into binary for computer science, digital electronics, or low-level programming. It is also useful when understanding how memory addresses, bit patterns, and machine data are represented.
Worked example, step by step
Convert 22 to binary: 22 ÷ 2 = 11 remainder 0 11 ÷ 2 = 5 remainder 1 5 ÷ 2 = 2 remainder 1 2 ÷ 2 = 1 remainder 0 1 ÷ 2 = 0 remainder 1 Read the remainders from bottom to top: 10110₂ So, 22 = 10110₂
Common mistakes to avoid
- Reading the remainders from top to bottom instead of bottom to top
- Forgetting to stop when the quotient reaches 0
- Mixing up the quotient and remainder at each division step
Did You Know?
Repeatedly dividing by 2 and reading the remainders bottom-up converts any number to binary.
Share this formula
More in Computer Science
View allShannon Entropy
AdvancedAverage information content of a random source (bits).
Master Theorem (form)
AdvancedAnalyzes running time of divide-and-conquer algorithms.
Hamming Distance
AdvancedNumber of positions at which two strings differ.
Bits to Represent n
BasicMinimum number of bits to represent n distinct values.
Binary to Decimal
BasicConverts a binary number to decimal.
Nodes in a Full Binary Tree
IntermediateTotal nodes in a perfect binary tree of height h.