Number Base Converter — Binary, Decimal, Hexadecimal, Octal
Convert between binary, decimal, hexadecimal, and octal number systems instantly. Practical guide to number bases for programmers and students.
Number base conversions are one of those things you either never think about or deal with daily — depending on whether you write code, work with networking, or study computer science. Binary, hexadecimal, and octal all exist because they map cleanly to how computers process data, and being able to convert between them is a practical skill.
The CalcHub number base converter handles binary, decimal, hexadecimal, and octal conversions instantly.
The Four Common Bases
| Base | Name | Digits Used | Example (decimal 255) |
|---|---|---|---|
| Base 2 | Binary | 0, 1 | 11111111 |
| Base 8 | Octal | 0–7 | 377 |
| Base 10 | Decimal | 0–9 | 255 |
| Base 16 | Hexadecimal | 0–9, A–F | FF |
Quick Reference Table
| Decimal | Binary | Hex | Octal |
|---|---|---|---|
| 0 | 0000 | 0 | 0 |
| 1 | 0001 | 1 | 1 |
| 5 | 0101 | 5 | 5 |
| 10 | 1010 | A | 12 |
| 15 | 1111 | F | 17 |
| 16 | 10000 | 10 | 20 |
| 32 | 100000 | 20 | 40 |
| 64 | 1000000 | 40 | 100 |
| 100 | 1100100 | 64 | 144 |
| 127 | 1111111 | 7F | 177 |
| 128 | 10000000 | 80 | 200 |
| 255 | 11111111 | FF | 377 |
| 256 | 100000000 | 100 | 400 |
Where Each Base Is Used
Binary (Base 2)
Everything inside a computer is binary — every file, instruction, and piece of data is ultimately 1s and 0s. You encounter binary directly when working with:- Bit flags and bitmasks — permission systems, feature toggles
- Network subnet masks — 255.255.255.0 = 11111111.11111111.11111111.00000000
- Low-level programming — embedded systems, hardware registers
Hexadecimal (Base 16)
Hex is the programmer's shorthand for binary. Every hex digit maps to exactly 4 binary digits, making it compact and readable:- Color codes — #FF5733 means R=255, G=87, B=51
- Memory addresses — 0x7FFE (easier to read than 32766)
- MAC addresses — AA:BB:CC:DD:EE:FF
- Unicode code points — U+0041 = "A"
- Cryptographic hashes — SHA-256 outputs are 64 hex characters
Octal (Base 8)
Octal is less common today but still shows up in:- Unix file permissions — chmod 755 means rwxr-xr-x (each digit is 3 binary bits)
- Legacy programming — some older systems and protocols use octal
Decimal (Base 10)
What humans use. The only reason we need converters is that computers don't think in tens.How to Convert Manually
Binary to Decimal
Each binary digit represents a power of 2 (right to left): 10110 = 1×16 + 0×8 + 1×4 + 1×2 + 0×1 = 16 + 4 + 2 = 22Decimal to Binary
Repeatedly divide by 2, read remainders bottom-up: 22 ÷ 2 = 11 remainder 0 11 ÷ 2 = 5 remainder 1 5 ÷ 2 = 2 remainder 1 2 ÷ 2 = 1 remainder 0 1 ÷ 2 = 0 remainder 1Read bottom-up: 10110 ✓
Binary to Hex (Shortcut)
Group binary digits in 4s from right, convert each group: 10110 → 0001 0110 → 1 6 → 0x16This is why hex exists — it's a compact way to write binary.
How to Use the CalcHub Number Base Converter
- Open the Number Base Converter at CalcHub
- Enter your number
- Select input base (e.g., "Decimal")
- Select output base (e.g., "Hexadecimal")
- See the converted value instantly
Why don't we use base 12 or base 8 in daily life?
Humans have 10 fingers, so base 10 became the default. Some ancient cultures did use base 12 (Babylonians for time — 12 hours, 60 minutes) and base 20 (Mayans). Base 10 isn't mathematically special — it's just what we're used to.
What's the largest number a byte can hold?
A byte is 8 bits. In binary: 11111111 = 255 in decimal = FF in hex. This is why color values range from 0–255 (one byte per channel).
Why do programmers prefix hex with "0x"?
It's a convention to distinguish hex from decimal. Without the prefix, "10" could mean ten (decimal) or sixteen (hex). "0x10" is unambiguously sixteen. Similarly, "0b" prefixes binary (0b1010 = 10 decimal) and "0o" prefixes octal.
Related Tools
- Text to Binary Converter — convert text to binary representation
- Text to Hex Converter — convert text to hexadecimal
- Hash Generator — generate hex-encoded hashes