Convert numbers between different bases (binary, octal, decimal, hexadecimal, and any base from 2 to 36).
A number base (also called radix) defines how many unique digits are used to represent numbers in a positional numeral system. In our everyday decimal system, we use base 10, which means we have 10 unique digits: 0 through 9. When we count past 9, we carry over to the next position and write "10."
Different bases work the same way but with different numbers of available digits. Binary (base 2) uses only 0 and 1. Octal (base 8) uses 0 through 7. Hexadecimal (base 16) uses 0 through 9 plus letters A through F to represent values 10 through 15.
The concept of positional notation means each digit's value depends on its position. In decimal, the number 253 represents 2×100 + 5×10 + 3×1, or equivalently 2×10² + 5×10¹ + 3×10⁰. The same principle applies to any base—you just replace 10 with the appropriate base value.
Binary is the foundation of all digital computing. Computers use binary because electronic circuits have two stable states: on and off, represented as 1 and 0. Every piece of digital information—from text and images to videos and software—ultimately exists as sequences of binary digits (bits).
A single binary digit is called a bit. Eight bits form a byte, which can represent values from 0 to 255 (or 00000000 to 11111111 in binary). Memory sizes, file sizes, and data transfer rates are all measured in bytes and their multiples.
Octal was historically popular in computing because it provides a compact way to represent binary data. Each octal digit corresponds exactly to three binary digits, making conversions straightforward. For example, the binary number 101110 can be split into groups of three (101 and 110), which convert to octal 56.
Today, octal appears primarily in Unix/Linux file permissions. When you see permission codes like 755 or 644, each digit represents read, write, and execute permissions for owner, group, and others respectively.
Decimal is the standard system for human counting and arithmetic, likely because humans have ten fingers. Nearly all everyday calculations, financial transactions, and measurements use decimal notation.
In computing, decimal is used for user-facing displays but converted to binary for internal processing. This conversion can sometimes cause precision issues with floating-point numbers, which is why financial software often uses specialized decimal arithmetic libraries.
Hexadecimal is essential in modern computing and programming. Each hex digit represents exactly four binary digits, making it perfect for expressing byte values compactly. A single byte (8 bits) becomes just two hex digits instead of eight binary digits.
Common uses for hexadecimal include:
To convert any number to decimal, multiply each digit by its positional value and sum the results. The positional value is the base raised to the power of the position, counting from 0 on the right.
For example, converting binary 1101 to decimal:
Converting hexadecimal 2F to decimal:
To convert from decimal to another base, repeatedly divide by the target base and collect the remainders. The remainders, read from last to first, form the converted number.
Converting decimal 47 to binary:
| Division | Quotient | Remainder |
|---|---|---|
| 47 ÷ 2 | 23 | 1 |
| 23 ÷ 2 | 11 | 1 |
| 11 ÷ 2 | 5 | 1 |
| 5 ÷ 2 | 2 | 1 |
| 2 ÷ 2 | 1 | 0 |
| 1 ÷ 2 | 0 | 1 |
Reading remainders from bottom to top: 47₁₀ = 101111₂
When converting between bases that are powers of each other, you can use shortcuts. Binary and hexadecimal have a 4:1 relationship (2⁴ = 16), so each hex digit equals exactly four binary digits.
Binary to hex example: 11010110₂
Binary to octal works similarly with groups of three (2³ = 8).
Bases beyond 16 use letters beyond F. Base 36 is the maximum commonly used because it employs all 10 digits (0-9) plus all 26 letters (A-Z), giving exactly 36 symbols.
Base 36 is sometimes called "alphanumeric base" and appears in:
Higher bases require additional symbols beyond the standard alphanumeric set, which creates compatibility issues and reduces readability.
Programmers constantly work with different bases:
Hardware engineers design circuits using binary logic. Understanding base conversion helps when:
Network protocols heavily use hexadecimal:
Base conversion principles underlie many encoding schemes:
| Decimal | Binary | Octal | Hex |
|---|---|---|---|
| 0 | 0000 | 0 | 0 |
| 1 | 0001 | 1 | 1 |
| 2 | 0010 | 2 | 2 |
| 3 | 0011 | 3 | 3 |
| 4 | 0100 | 4 | 4 |
| 5 | 0101 | 5 | 5 |
| 6 | 0110 | 6 | 6 |
| 7 | 0111 | 7 | 7 |
| 8 | 1000 | 10 | 8 |
| 9 | 1001 | 11 | 9 |
| 10 | 1010 | 12 | A |
| 11 | 1011 | 13 | B |
| 12 | 1100 | 14 | C |
| 13 | 1101 | 15 | D |
| 14 | 1110 | 16 | E |
| 15 | 1111 | 17 | F |
| 16 | 10000 | 20 | 10 |
| 32 | 100000 | 40 | 20 |
| 64 | 1000000 | 100 | 40 |
| 128 | 10000000 | 200 | 80 |
| 255 | 11111111 | 377 | FF |
| 256 | 100000000 | 400 | 100 |
This calculator handles integer conversions for arbitrary precision using BigInt, which means it can convert very large numbers accurately. However, there are some considerations:
Fractional numbers: This calculator handles integers only. Converting fractional parts requires different algorithms and may result in repeating sequences.
Negative numbers: The calculator works with positive integers. Negative numbers in computing use representations like two's complement, which this calculator doesn't address.
Leading zeros: The output omits leading zeros. If you need a specific number of digits (like for byte representation), you may need to pad the result.
Case sensitivity: The calculator accepts both uppercase and lowercase letters for bases above 10. Results are displayed in uppercase for consistency.