Number Base Converter: Binary, Octal, Decimal, Hexadecimal
This tool converts numbers between the four most commonly used number bases in computer science and mathematics: binary (base 2), octal (base 8), decimal (base 10), and hexadecimal (base 16). It shows all representations simultaneously and the conversion steps.
The Most Common Number Bases
In daily life we use the decimal system (base 10), with digits 0-9. But in computing and electronics, other bases are used:
- Binary (base 2): only 0 and 1. The native language of computers: each bit represents an on/off state. Eight bits form a byte, which can represent 256 different values.
- Octal (base 8): digits 0-7. Historically used in Unix systems for file permissions (e.g. chmod 755).
- Hexadecimal (base 16): digits 0-9 and letters A-F. Each digit corresponds to exactly 4 bits, making it a compact notation for binary. Widely used for web colors (#FF5733), memory addresses, and software debugging.
How Conversion Works
The general method involves two steps:
- From source base to decimal: multiply each digit by the base raised to the power of its position, starting from 0 on the right.
- From decimal to target base: repeatedly divide the decimal number by the base, noting the remainders. The remainders read in reverse give the result.
Practical Applications
Base conversion is fundamental for programmers, computer science students, and electronics enthusiasts. CSS colors use hexadecimal (#RRGGBB), IPv6 addresses are in hexadecimal, Unix permissions use octal, and understanding binary is essential for grasping how computers work at the hardware level.