Binary Converter
Convert between binary, decimal, hexadecimal, and octal — plus text to binary
Advertisement
Understanding Number Bases
Computers work exclusively with binary — 0s and 1s — because electronic circuits have two states: on and off. But representing large numbers in pure binary gets unwieldy fast. That's why developers use other bases as shortcuts:
| Base | Name | Digits used | Why it's used |
|---|---|---|---|
| 2 | Binary | 0, 1 | Native machine language |
| 8 | Octal | 0–7 | Unix file permissions (e.g., chmod 755) |
| 10 | Decimal | 0–9 | Human everyday counting |
| 16 | Hexadecimal | 0–9, A–F | Compact binary — 1 hex digit = 4 bits |
How Binary Works
In binary (base 2), each digit position represents a power of 2. Reading right to left: 1, 2, 4, 8, 16, 32, 64, 128...
Example: 1011 in binary = 1×8 + 0×4 + 1×2 + 1×1 = 11 in decimal.
Computers group binary digits into bytes (8 bits). One byte can represent 256 values (0–255). That's why IP addresses have four numbers each capped at 255, and why ASCII characters fit within one byte.
Hexadecimal in Practice
Hexadecimal is everywhere in programming. CSS colors use it — #FF5733 is three hex pairs (FF=red, 57=green, 33=blue), each mapping to a decimal 0–255 value. Memory addresses, SHA hashes, MAC addresses, and HTML color codes all use hex because one hex character represents exactly 4 binary digits, making it a clean shorthand.
Octal and Unix Permissions
Octal shows up most often in Unix file permissions. chmod 755 means owner gets 7 (rwx = 4+2+1), group gets 5 (r-x = 4+0+1), and others get 5. Each octal digit represents exactly 3 binary digits, making permission bits readable at a glance.
Advertisement
Frequently Asked Questions
0x is a prefix indicating hexadecimal in most programming languages. So 0xFF means 255 in decimal. Similarly, 0b prefixes binary (0b1010 = 10) and 0o or 0 prefixes octal in many languages.rgb(255, 87, 51) once you're used to it.