Number Base Converter
Convert numbers between binary, octal, decimal, hexadecimal, and any base from 2 to 36.
Shows full conversion steps for programming and computer science.
Number base systems (also called radixes or positional numeral systems) are the foundation of all digital computing. Every computer in existence operates exclusively in binary (base 2), yet humans work most naturally in decimal (base 10). Converting between bases is a core skill in computer science, electronics, and low-level programming.
The four most important bases:
| Base | Name | Digits Used | Primary Use |
|---|---|---|---|
| 2 | Binary | 0, 1 | All digital hardware |
| 8 | Octal | 0–7 | Unix/Linux file permissions |
| 10 | Decimal | 0–9 | Human counting, everyday math |
| 16 | Hexadecimal | 0–9, A–F | Colors, memory addresses, debugging |
Converting decimal to any base — repeated division algorithm: Divide the decimal number by the target base, record the remainder, then repeat with the quotient until it reaches 0. Read remainders from bottom to top.
Worked example — decimal 178 to binary (base 2):
- 178 ÷ 2 = 89, remainder 0
- 89 ÷ 2 = 44, remainder 1
- 44 ÷ 2 = 22, remainder 0
- 22 ÷ 2 = 11, remainder 0
- 11 ÷ 2 = 5, remainder 1
- 5 ÷ 2 = 2, remainder 1
- 2 ÷ 2 = 1, remainder 0
- 1 ÷ 2 = 0, remainder 1
- Read bottom to top: 10110010
Converting from any base to decimal — positional value method:
Decimal Value = d_n × base^n + d_{n-1} × base^{n-1} + ... + d_1 × base^1 + d_0 × base^0
Worked example — binary 10110010 to decimal: = 1×128 + 0×64 + 1×32 + 1×16 + 0×8 + 0×4 + 1×2 + 0×1 = 128 + 32 + 16 + 2 = 178 ✓
Hexadecimal digit mapping:
| Decimal | Hex | Binary |
|---|---|---|
| 10 | A | 1010 |
| 11 | B | 1011 |
| 12 | C | 1100 |
| 13 | D | 1101 |
| 14 | E | 1110 |
| 15 | F | 1111 |
Handy cross-reference table:
| Decimal | Binary | Octal | Hex |
|---|---|---|---|
| 8 | 1000 | 10 | 8 |
| 16 | 10000 | 20 | 10 |
| 64 | 1000000 | 100 | 40 |
| 127 | 1111111 | 177 | 7F |
| 255 | 11111111 | 377 | FF |
| 256 | 100000000 | 400 | 100 |
| 65535 | 1111111111111111 | 177777 | FFFF |
Real-world applications:
- Web colors: #FF5733 is hex — Red=FF(255), Green=57(87), Blue=33(51)
- IPv4 addresses: 192.168.1.1 in decimal; each octet is one byte (0–255)
- File permissions: chmod 755 in octal = 111 101 101 in binary (rwxr-xr-x)
- ASCII codes: Character ‘A’ = decimal 65 = hex 41 = binary 1000001