Converting numbers between number systems is a foundational topic in computer science classes, and also a practical skill for programming. Let's walk through how to convert a decimal number to binary (and back) by hand, and when it's easier to just use a ready-made tool.
Converting a decimal number to binary
Divide the number by 2 repeatedly, writing down the remainder each time, until the quotient reaches zero. Then read the remainders from bottom to top.
Example for the number 13:
13 ÷ 2 = 6, remainder 1
6 ÷ 2 = 3, remainder 0
3 ÷ 2 = 1, remainder 1
1 ÷ 2 = 0, remainder 1
Reading the remainders bottom to top gives 1101. So decimal 13 equals binary 1101.
Converting a binary number to decimal
Multiply each binary digit by the corresponding power of two based on its position (right to left, starting at power 0), then add up the results.
For 1101:
1×2³ + 1×2² + 0×2¹ + 1×2⁰ = 8 + 4 + 0 + 1 = 13