What the number base converter does
The converter takes a value in binary, decimal, hexadecimal or octal and shows it in all the others at once. It also converts text to and from binary — each character to its 8-bit code — which is handy for teaching, puzzles and checking encodings. Enter a value, choose which base it is in, and read off the rest. Everything runs in your browser.
The four bases
| Base | Digits | Prefix in code | Where you see it |
|---|---|---|---|
| Binary (2) | 0 1 | 0b1010 | Bit flags, subnet masks, hardware registers |
| Octal (8) | 0–7 | 0o755 or 0755 | Unix file permissions |
| Decimal (10) | 0–9 | none | Everyday numbers |
| Hexadecimal (16) | 0–9 A–F | 0x1F or #1F | Colours, memory addresses, hashes, MAC addresses, bytes |
Hex and octal are popular because they line up with binary exactly: one hex digit is four bits, one octal digit is three. Converting between them is a matter of grouping digits, no arithmetic required.
Converting by hand
Decimal 202 → binary: divide by 2, read remainders bottom-up
202 ÷ 2 = 101 r 0
101 ÷ 2 = 50 r 1
50 ÷ 2 = 25 r 0
25 ÷ 2 = 12 r 1
12 ÷ 2 = 6 r 0
6 ÷ 2 = 3 r 0
3 ÷ 2 = 1 r 1
1 ÷ 2 = 0 r 1 → 11001010
Binary 11001010 → hex: group in fours from the right
1100 1010 → C A → 0xCA
Binary 11001010 → octal: group in threes from the right
011 001 010 → 3 1 2 → 0o312
Hex 0xCA → decimal: 12 × 16 + 10 = 202Useful values to recognise
| Decimal | Binary | Hex | Meaning |
|---|---|---|---|
| 255 | 11111111 | FF | Max unsigned byte; one octet of an IP address |
| 256 | 1 00000000 | 100 | 2⁸ |
| 1024 | 100 00000000 | 400 | 2¹⁰ — one kibibyte |
| 65535 | 16 ones | FFFF | Max 16-bit unsigned; highest port number |
| 4294967295 | 32 ones | FFFFFFFF | Max 32-bit unsigned; 255.255.255.255 |
| 127 | 01111111 | 7F | Max signed byte; last ASCII code |
| -1 (8-bit two's complement) | 11111111 | FF | Same bits as 255 — sign is interpretation |
Text to binary
Each character has a code point; ASCII covers 0–127 and UTF-8 extends it. The converter shows one byte per ASCII character as eight bits:
"Hi" → 01001000 01101001
H = 72 = 0x48 i = 105 = 0x69Characters outside ASCII (accented letters, Thai, emoji) take two to four bytes in UTF-8, so a single character may appear as several groups of eight bits. Converting binary back to text assumes the same encoding.
Where each base turns up in practice
- Colours:
#E85D26is three hex bytes — red 232, green 93, blue 38. - File permissions:
chmod 755is octal forrwxr-xr-x— 111 101 101 in binary. - Subnet masks:
255.255.255.0is 24 ones followed by 8 zeros, hence/24. - Bit flags: options combined with OR, checked with AND — read them in binary to see which are set.
- Hashes and IDs: SHA-256 output, UUIDs and MAC addresses are hex because it is compact and byte-aligned.
- Memory and debugging: addresses, opcodes and register dumps are shown in hex.