Convert between binary, decimal, hexadecimal, and octal number systems instantly. Also translates text to binary (ASCII) and back. Perfect for CS students and developers.
Binary is base-2, using only 0 and 1. Each position represents a power of 2:
To convert binary to decimal: multiply each digit by its positional value and add. Binary 1011=(1×8)+(0×4)+(1×2)+(1×1)=11. Binary 11111111=128+64+32+16+8+4+2+1=255.
A transistor — the fundamental building block of modern processors — has two stable states: conducting (1) and not conducting (0). These map directly to binary's two digits. Distinguishing two voltage levels is far more reliable than distinguishing ten. Binary also enables logic gates — AND, OR, NOT, XOR — which implement all arithmetic and logic through simple transistor combinations. Modern CPUs contain billions of such transistors operating billions of times per second.
Hexadecimal (base 16) uses digits 0–9 and A–F (A=10, B=11...F=15). Each hex digit represents exactly 4 binary bits:
Hex appears everywhere: web colors (#FF5733), memory addresses (0x7FFE4A20), file signatures (JPEGs start with FF D8 FF). The 0x prefix indicates hexadecimal — 0xFF=255, 0x1A=26.
To negate a binary number using two's complement: flip all bits, then add 1. In 8-bit: +1=00000001. Flip: 11111110. Add 1: 11111111=−1. The leftmost bit is the sign bit (0=positive, 1=negative). This allows subtraction to be performed using the same addition hardware as positive numbers — a key CPU design simplification.
ASCII maps characters to numbers (0–127). A=65=01000001, a=97=01100001, space=32=00100000. The case difference in ASCII between uppercase and lowercase letters is exactly 32 (00100000) — a single bit toggle switches case. ASCII was extended to Unicode (UTF-8), which supports all world scripts and emoji using 1–4 bytes per character, while keeping ASCII characters as valid single-byte sequences for backward compatibility.
Octal (base 8) uses digits 0–7. Each octal digit represents exactly 3 binary bits. Today octal survives primarily in Unix/Linux file permissions. chmod 755 sets permissions in octal: 7 (111=rwx), 5 (101=r-x), 5 (101=r-x). The three digits represent permissions for owner, group, and others respectively. Understanding octal is essential for Unix/Linux system administration.