Number Systems Explained: Binary, Hex, Octal & Decimal
Understanding binary, octal, decimal, and hexadecimal number systems and their uses in computing.
Convert between binary, hex, octal, and decimal
2 articles to help you understand and use this tool effectively
Understanding binary, octal, decimal, and hexadecimal number systems and their uses in computing.
How to convert between number bases using JavaScript's built-in methods.
Common questions about using the Number Base Converter tool
Enter a decimal number, select 'Decimal' as input base. The binary equivalent appears instantly. Manual method: repeatedly divide by 2, read remainders bottom-up. Example: 13 → 1101 (13÷2=6r1, 6÷2=3r0, 3÷2=1r1, 1÷2=0r1).
Enter binary digits (0s and 1s), select 'Binary' as input base. Manual method: multiply each digit by its position power of 2, sum results. Example: 1101 = 1×8 + 1×4 + 0×2 + 1×1 = 13.
Hexadecimal (hex) is base-16 using digits 0-9 and A-F (10-15). Compact representation of binary (4 bits = 1 hex digit). Common in: colors (#FF0000), memory addresses, MAC addresses, programming. Example: 255 = FF, 16 = 10.
Enter hex value (e.g., FF), select 'Hexadecimal' as input. Manual: multiply each digit by power of 16. Example: 2F = 2×16 + 15×1 = 47. Hex digits: A=10, B=11, C=12, D=13, E=14, F=15.
Octal is base-8 using digits 0-7. Historically used in computing (3 bits = 1 octal digit). Still seen in Unix file permissions: chmod 755 means rwxr-xr-x. Less common today than hex.
Hex is compact (2 hex digits = 1 byte) and aligns with binary (4 bits = 1 hex digit). Easy to read memory dumps, colors, and byte values. Converting hex↔binary is simpler than decimal↔binary.
Group binary into 4-bit chunks (right to left), convert each to hex. Example: 11111111 → 1111 1111 → F F → FF. Reverse for hex to binary: F → 1111. This direct conversion is why hex is popular in computing.
0x indicates hexadecimal in programming (0xFF = 255). Other prefixes: 0b for binary (0b1111 = 15), 0o for octal (0o17 = 15). Without prefix, numbers are assumed decimal. These prefixes prevent ambiguity.
Computers use two's complement for negative binary numbers. The tool handles standard conversions. For signed interpretation: MSB (most significant bit) indicates sign. -1 in 8-bit is 11111111 (255 unsigned).
Binary (base-2): computer's native language. Octal (base-8): Unix permissions. Decimal (base-10): human-readable. Hexadecimal (base-16): colors, memory, bytes. Base-64: encoding binary as text.