Base Converter
Type a number in any field — decimal, binary, octal, or hexadecimal — and all other fields update automatically.
Edit any field — all others update instantly
Number Bases Explained
A number base (or radix) defines how many unique digits are available in a positional numeral system. The position of each digit determines its value, which is the base raised to the power of that position.
In decimal (base 10), which humans use naturally, each position represents a power of 10:
2024 = 2 × 10³ + 0 × 10² + 2 × 10¹ + 4 × 10⁰
The same concept applies to all other bases — only the base number changes.
The Four Common Number Bases
| Base | Name | Digits Used | Prefix | Main Use |
|---|---|---|---|---|
| 2 | Binary | 0, 1 | 0b | Computer hardware, digital logic |
| 8 | Octal | 0–7 | 0o | Unix file permissions, legacy systems |
| 10 | Decimal | 0–9 | (none) | Everyday counting, mathematics |
| 16 | Hexadecimal | 0–9, A–F | 0x | Memory addresses, colors, encoding |
Conversion Reference Table
| Decimal | Binary | Octal | Hex |
|---|---|---|---|
| 0 | 0 | 0 | 0 |
| 1 | 1 | 1 | 1 |
| 2 | 10 | 2 | 2 |
| 4 | 100 | 4 | 4 |
| 8 | 1000 | 10 | 8 |
| 10 | 1010 | 12 | A |
| 15 | 1111 | 17 | F |
| 16 | 10000 | 20 | 10 |
| 32 | 100000 | 40 | 20 |
| 64 | 1000000 | 100 | 40 |
| 255 | 11111111 | 377 | FF |
| 256 | 100000000 | 400 | 100 |
| 1024 | 10000000000 | 2000 | 400 |
Binary (Base 2)
Binary is the foundation of all digital computing. Every piece of data in a computer is ultimately stored as binary — sequences of 0s and 1s representing off/on states in transistors. Understanding binary helps with:
- Bit manipulation: Operations like AND, OR, XOR, bit shifts in programming
- Understanding data sizes: 1 byte = 8 bits = 11111111 in binary = 255 decimal
- Networking: IP addresses, subnet masks, and CIDR notation use binary logic
- Digital electronics: Logic gates, flip-flops, and memory cells are binary by nature
Hexadecimal (Base 16)
Hexadecimal is the most practical human-readable format for binary data because each hex digit represents exactly 4 binary bits (a nibble):
F= 1111 in binaryFF= 11111111 = 255 decimal = one byte max value#FF5733(an orange color in CSS) = R:255, G:87, B:51
Hex is used pervasively in:
- Web colors: #RRGGBB format
- Memory addresses: 0x7FFE3A2B
- MAC addresses: 00:1A:2B:3C:4D:5E
- SHA/MD5 hashes: File checksums
- Unicode code points: U+1F600 (emoji 😀)
Octal (Base 8)
Octal is mostly encountered in Unix/Linux file permissions:
chmod 755= binary 111 101 101 = rwxr-xr-x (owner can read/write/execute; group and others can read/execute)chmod 644= binary 110 100 100 = rw-r--r-- (owner can read/write; others read only)
Frequently Asked Questions
How do I convert binary to decimal by hand?
Write down the binary number, then assign powers of 2 from right to left (2⁰=1, 2¹=2, 2²=4, 2³=8...). Multiply each bit by its power of 2 and sum the results. Example: 1011 = 1×8 + 0×4 + 1×2 + 1×1 = 8 + 0 + 2 + 1 = 11.
Why do computers use binary instead of decimal?
Electronic circuits have two reliable states: on (high voltage) and off (low voltage). These map directly to 1 and 0. Building hardware to reliably distinguish 10 different voltage levels (for decimal) would be far more complex, error-prone, and expensive.
What is a byte and why is it 8 bits?
A byte is 8 bits. This became standard because it can encode 256 different values (2⁸ = 256), which is enough for all ASCII characters. Early computers used various byte sizes (5, 6, 7 bits) but 8-bit bytes won out commercially with the IBM System/360 in 1964.
What does 0xFF mean in programming?
0xFF is hexadecimal notation for the number 255 (decimal) or 11111111 (binary). It represents the maximum value of an 8-bit unsigned integer (one byte). In many languages, the 0x prefix indicates a hexadecimal literal. You will often see it in color values, bitmasks, and memory operations.
How are colors stored in computers?
Web colors use the hex format #RRGGBB where RR, GG, and BB are each two-digit hexadecimal values representing red, green, and blue intensity from 0 (00) to 255 (FF). For example, #FF0000 is pure red, #00FF00 is pure green, #0000FF is pure blue, and #FFFFFF is white.
Related Tools
- Roman Numeral Converter — Convert between Arabic and Roman numerals
- Text Case Converter — Convert between coding case styles
- Percentage Calculator — Quick percentage math
- QR Generator — Generate QR codes from text
- Date Calculator — Calculate time between dates
Sources
- Patterson, D.A. & Hennessy, J.L. Computer Organization and Design. Morgan Kaufmann
- IEEE Standard 754: Floating-Point Arithmetic
- The Open Group: chmod — Unix File Permissions