How to convert
- Positional expansion: multiply each digit by 2 to the power of its position (rightmost is 0) and add.
- Example: 1011 = 1×2³ + 0×2² + 1×2¹ + 1×2⁰ = 8 + 0 + 2 + 1 = 11.
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.
Binary to Decimal table
| Binary | Decimal | Hex |
|---|---|---|
| 0 | 0 | 0 |
| 1 | 1 | 1 |
| 10 | 2 | 2 |
| 11 | 3 | 3 |
| 100 | 4 | 4 |
| 101 | 5 | 5 |
| 110 | 6 | 6 |
| 111 | 7 | 7 |
| 1000 | 8 | 8 |
| 1001 | 9 | 9 |
| 1010 | 10 | A |
| 1011 | 11 | B |
| 1100 | 12 | C |
| 1101 | 13 | D |
| 1110 | 14 | E |
| 1111 | 15 | F |
| 1 0000 | 16 | 10 |
| 10 0000 | 32 | 20 |
| 100 0000 | 64 | 40 |
| 110 0100 | 100 | 64 |
| 111 1111 | 127 | 7F |
| 1000 0000 | 128 | 80 |
| 1111 1111 | 255 | FF |
| 1 0000 0000 | 256 | 100 |
| 11 1110 1000 | 1000 | 3E8 |
| 100 0000 0000 | 1024 | 400 |
| 1 0000 0000 0000 | 4096 | 1000 |
| 1111 1111 1111 1111 | 65535 | FFFF |