Number Base Converter
Convert numbers between binary, octal, decimal, hexadecimal, and any base from 2 to 36.
Results
Number Bases and Base Conversion
A number base (or radix) defines how many distinct digits are used in a positional number system. We use base 10 daily (digits 0–9), but computers work in base 2 (binary), and programmers regularly use base 16 (hexadecimal) and base 8 (octal).
Binary (Base 2)
Binary uses only 0 and 1. Every digital device stores and processes data in binary form — each binary digit (bit) represents a power of 2. Eight bits = 1 byte, which can represent values 0–255. To convert binary 1101 to decimal: 1×8 + 1×4 + 0×2 + 1×1 = 13.
Octal (Base 8)
Octal uses digits 0–7. Each octal digit represents exactly 3 binary bits, making it convenient shorthand for binary. Unix file permissions use octal (chmod 755 = rwxr-xr-x). To convert octal 17 to decimal: 1×8 + 7×1 = 15.
Hexadecimal (Base 16)
Hex uses digits 0–9 and letters A–F (where A=10, B=11, …, F=15). One hex digit represents 4 binary bits. Two hex digits represent 1 byte (0x00 to 0xFF = 0–255). HTML/CSS colors use hex: #FF0000 is pure red (R=255, G=0, B=0). Memory addresses and machine code are typically displayed in hex.
Conversion Method
To convert from any base to decimal: multiply each digit by its base raised to the position power (starting from 0 at the right) and sum. To convert from decimal to any base: repeatedly divide by the target base, recording remainders from right to left. For bases above 10, remainders 10+ are represented by letters (A=10, B=11, ..., Z=35).
Worked Example: Decimal 200 in All Bases
The decimal number 200 converted: Binary (base 2) = 11001000 (128+64+8 = 200). Octal (base 8) = 310 (3×64 + 1×8 + 0 = 200). Hexadecimal (base 16) = C8 (12×16 + 8 = 200). This shows that the same quantity can look very different depending on the base used.
| Decimal | Binary (2) | Octal (8) | Hex (16) |
|---|---|---|---|
| 10 | 1010 | 12 | A |
| 16 | 10000 | 20 | 10 |
| 64 | 1000000 | 100 | 40 |
| 100 | 1100100 | 144 | 64 |
| 255 | 11111111 | 377 | FF |
Frequently Asked Questions
Multiply each bit by 2^position (0 from right) and sum. Binary 1010: 1×8 + 0×4 + 1×2 + 0×1 = 10. Binary 1111 = 1×8+1×4+1×2+1×1 = 15.
Divide repeatedly by 16, noting remainders. Remainders 10-15 are A-F. For 255: 255 / 16 = 15 remainder 15 (F), then 15 = F → result is FF.
Memory addresses, color codes (#RRGGBB), machine code, debuggers, and network addresses (IPv6). Each hex digit represents exactly 4 bits, making it more compact than binary.
Octal uses 0-7 only. Each octal digit represents 3 binary bits. Unix permissions use octal: 7=111 (read+write+execute), 5=101 (read+execute), 4=100 (read-only).
#RRGGBB — two hex digits per color channel. #FF0000 = max red, no green, no blue. #00FF00 = green. #FFFFFF = white (255,255,255). #000000 = black (0,0,0).
Hexadecimal needs 16 unique symbols but our standard digits only go 0-9 (10 symbols). Letters A through F fill the gap: A=10, B=11, C=12, D=13, E=14, F=15. This convention is universal in computing and all major programming languages.
Group binary digits in sets of 4 from the right — each group maps directly to one hex digit. Binary 10111100 splits into 1011 (= B) and 1100 (= C), giving hex BC. This works because 2 to the power of 4 = 16, so each hex digit represents exactly 4 binary bits.