Best uses
- Understand how computers represent decimal numbers.
- Check classwork, coding examples, or electronics values.
- Convert integers before using them in bit operations.
To convert the whole-number part of a decimal value to binary, divide by 2 and read the remainders in reverse order. For the fractional part, multiply by 2 repeatedly and record each whole-number result until the fraction becomes 0 or reaches the precision you need. The example below shows the process:
(10.25)10 = (?)2
| Divided by 2 | Quotient | Remainder | Flow |
|---|---|---|---|
| 10 / 2 | 5 | 0 | ↓ |
| 5 / 2 | 2 | 1 | ↓ |
| 2 / 2 | 1 | 0 | ↓ |
| 1 / 2 | 0 | 1 | ↓ |
| Multiply by 2 | Result | Non-Fractional Part | Flow |
|---|---|---|---|
| .25 * 2 | 0.50 | 0 | ↓ |
| .50 * 2 | 1.00 | 1 | ↓ |
Decimal numbers are easy for people to read, while binary is the base used in digital systems. Converting decimal to binary helps with programming lessons, bitwise operations, networking examples, computer architecture, and digital electronics problems.
| Decimal | Binary |
|---|---|
| 0 | 0 |
| 1 | 1 |
| 2 | 10 |
| 3 | 11 |
| 4 | 100 |
| 5 | 101 |
| 6 | 110 |
| 7 | 111 |
| 8 | 1000 |
| 9 | 1001 |
| 10 | 1010 |
| 11 | 1011 |
| 12 | 1100 |
| 13 | 1101 |
| 14 | 1110 |
| 15 | 1111 |
To convert a decimal whole number to binary, divide by 2 and track the remainders. Read the remainders from bottom to top to get the binary value.
Divide by 2 repeatedly and read the remainders upward. 42 becomes 101010.
Binary is base 2, so each digit can only represent two possible values.