The decimal number system (base 10) uses the digits \(0\) to \(9\), while the binary number system (base 2) uses only the digits \(0\) and \(1\).
In the decimal system, each digit represents a power of \(10\). For example:
\[ 149 = 1 \times 10^2 + 4 \times 10^1 + 9 \times 10^0 \]Similarly, each digit in a binary number represents a power of \(2\).
Convert the binary number \(10010101_2\) to decimal:
\[ \begin{aligned} 10010101_2 &= 1\times2^7 + 0\times2^6 + 0\times2^5 + 1\times2^4 \\ &\quad + 0\times2^3 + 1\times2^2 + 0\times2^1 + 1\times2^0 \\ &= 128 + 16 + 4 + 1 \\ &= 149 \end{aligned} \]Therefore, the binary number \(10010101_2\) is equal to \(149_{10}\).
To convert a decimal number into binary, repeatedly divide the number by \(2\) and record the remainders. The binary number is obtained by reading the remainders from bottom to top.
Example: Convert the decimal number \(123\) to binary.
\[ \begin{aligned} 123 \div 2 &= 61 \quad r = 1 \\ 61 \div 2 &= 30 \quad r = 1 \\ 30 \div 2 &= 15 \quad r = 0 \\ 15 \div 2 &= 7 \quad r = 1 \\ 7 \div 2 &= 3 \quad r = 1 \\ 3 \div 2 &= 1 \quad r = 1 \\ 1 \div 2 &= 0 \quad r = 1 \end{aligned} \]Reading the remainders from bottom to top gives:
\[ 123_{10} = 1111011_2 \]Verification:
\[ 1111011_2 = 1\times2^6 + 1\times2^5 + 1\times2^4 + 1\times2^3 + 0\times2^2 + 1\times2^1 + 1\times2^0 = 123 \]You may also use this online tool: Decimal to Binary Converter.