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 allGustafson’s Law
IntermediateIdeal scaled-workload speedup when more processors allow a larger parallel task in the same elapsed time. Here s is the serial fraction of the parallel execution time, not the single-processor fraction used in Amdahl’s law.
Hick–Hyman Law (Equal Choices)
IntermediateModels choice reaction time for n equally likely alternatives (n ≥ 1). This information-theoretic form assumes comparable, practised stimulus–response choices; it is not a universal law of menu browsing.
Fitts’s Law (Shannon Form)
IntermediateAn empirical model of aimed movement time: farther or narrower targets generally take longer to reach. Use D ≥ 0, W > 0 and fitted coefficients for the device and task.
Shannon 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.