How to convert
- Repeated division: divide the decimal number by 2, note each remainder until the quotient is 0, then read the remainders bottom-up.
- Example: 11 ÷ 2 = 5 r 1, 5 ÷ 2 = 2 r 1, 2 ÷ 2 = 1 r 0, 1 ÷ 2 = 0 r 1 → 1011.
Notes
- Integers of any length are converted exactly — no scientific notation.
- Prefixes are accepted: 0x for hex, 0b for binary, 0o for octal; spaces and underscores are ignored.
- Negative numbers: prefix with "-". Fractions are not supported yet.
Decimal to Binary table
| Decimal | Binary | Hex |
|---|---|---|
| 0 | 0 | 0 |
| 1 | 1 | 1 |
| 2 | 10 | 2 |
| 3 | 11 | 3 |
| 4 | 100 | 4 |
| 5 | 101 | 5 |
| 6 | 110 | 6 |
| 7 | 111 | 7 |
| 8 | 1000 | 8 |
| 9 | 1001 | 9 |
| 10 | 1010 | A |
| 11 | 1011 | B |
| 12 | 1100 | C |
| 13 | 1101 | D |
| 14 | 1110 | E |
| 15 | 1111 | F |
| 16 | 1 0000 | 10 |
| 32 | 10 0000 | 20 |
| 64 | 100 0000 | 40 |
| 100 | 110 0100 | 64 |
| 127 | 111 1111 | 7F |
| 128 | 1000 0000 | 80 |
| 255 | 1111 1111 | FF |
| 256 | 1 0000 0000 | 100 |
| 1000 | 11 1110 1000 | 3E8 |
| 1024 | 100 0000 0000 | 400 |
| 4096 | 1 0000 0000 0000 | 1000 |
| 65535 | 1111 1111 1111 1111 | FFFF |