Number Base Converter
Convert any number between any bases 2–36: binary, octal, decimal, hex, and beyond. Shows positional expansion and repeated-division step-by-step.
📊 What is a Number Base?
The number base (or radix) is the number of distinct digit symbols used in a positional numeral system. In positional notation, the value of each digit depends on its position: the digit at position i (counting from 0 on the right) represents that digit multiplied by the base raised to the power i.
Common bases:
- Base 2 (binary) - digits 0, 1. The language of digital electronics.
- Base 8 (octal) - digits 0–7. Used in Unix file permissions.
- Base 10 (decimal) - digits 0–9. Our everyday number system.
- Base 16 (hexadecimal) - digits 0–9 and A–F. Standard for memory addresses, color codes, and byte-level data.
Binary, octal, and hex are all powers of 2 (2¹, 2³, 2⁴), which means they interconvert without an intermediate decimal step - 4 binary digits map to one hex digit, and 3 binary digits map to one octal digit.
📐 Formula
Converting to decimal (positional expansion): n₁₀ = d_k × b^k + d_{k−1} × b^{k−1} + … + d_1 × b + d_0
Converting from decimal (repeated division):
- Divide n by the target base b
- Record the remainder (this is the lowest-order digit)
- Replace n with the quotient and repeat until n = 0
- Read remainders from bottom to top
Direct binary ↔ hex: Group 4 binary digits from the right → each group = one hex digit
Variables:
- b - the base (radix)
- d_i - the digit at position i
- n - the integer value in decimal
📖 How to Use
Steps to Calculate
💡 Example Calculations
Example 1 — Decimal 255 to Binary, Octal, Hex
Convert 255₁₀ to all common bases
Example 2 — Hex A3 to Decimal and Binary
Convert A3₁₆ to decimal and binary
Example 3 — Binary 11010 to Decimal
Convert 11010₂ to decimal
❓ Frequently Asked Questions
🔗 Related Calculators
What is a number base (radix)?
A number base (or radix) is the number of distinct digits used in a positional numeral system. Base 10 (decimal) uses digits 0–9. Base 2 (binary) uses only 0 and 1. Base 16 (hex) uses 0–9 and A–F (where A=10, B=11, ..., F=15). In base b, the digit in position i (counting from 0 on the right) represents that digit × b^i. So 1011₂ = 1×8 + 0×4 + 1×2 + 1×1 = 11₁₀.
How do you convert from binary to decimal?
Write out the positional values: the rightmost bit is 2⁰=1, next is 2¹=2, then 2²=4, 2³=8, etc. For each bit that is 1, add its positional value. Example: 11010₂ = 1×16 + 1×8 + 0×4 + 1×2 + 0×1 = 16+8+2 = 26₁₀. For a fraction like 0.101₂: 1×2⁻¹ + 0×2⁻² + 1×2⁻³ = 0.5 + 0 + 0.125 = 0.625₁₀.
How do you convert from decimal to binary?
Use repeated division by 2: divide the number by 2, record the remainder (0 or 1), then divide the quotient by 2 again, and repeat until the quotient is 0. Read the remainders from bottom to top. Example: 26 ÷ 2 = 13 R 0, 13 ÷ 2 = 6 R 1, 6 ÷ 2 = 3 R 0, 3 ÷ 2 = 1 R 1, 1 ÷ 2 = 0 R 1 → reading bottom-up: 11010₂.
What is hexadecimal and why is it used in computing?
Hexadecimal (base 16) uses digits 0–9 and letters A–F. It's used in computing because each hex digit represents exactly 4 bits (a nibble), so two hex digits represent one byte (8 bits). This makes hex a compact notation for binary data: the 8-bit value 11111111₂ = FF₁₆ = 255₁₀. Memory addresses, color codes (#RRGGBB), and machine code are typically shown in hex for readability.
How do you convert between binary and hexadecimal directly?
Group the binary digits into groups of 4 from the right (pad with leading zeros if needed), then convert each group to its hex digit. Example: 11010110₂ → split as 1101 0110 → D6₁₆. Going the other way, expand each hex digit to 4 binary bits: B4₁₆ → 1011 0100₂. No intermediate decimal step is needed because 16 = 2⁴.
How do you convert between binary and octal?
Group binary digits into groups of 3 from the right (pad with leading zeros), then convert each group to its octal digit (0–7). Example: 11010110₂ → 011 010 110 → 326₈. Going the other way: each octal digit expands to 3 binary bits: 7₈ = 111₂, 5₈ = 101₂. This works because 8 = 2³.
What are the common number bases in computing?
Binary (base 2): native language of digital hardware, where 0 = low voltage and 1 = high voltage. Octal (base 8): used in Unix file permissions (e.g., chmod 755) and some older systems. Decimal (base 10): standard for human-readable values. Hexadecimal (base 16): standard for memory addresses, color codes, cryptographic hashes, and byte-level data representation. Base 64: used for encoding binary data in text (email attachments, URLs).
What is positional notation?
Positional notation means the value of a digit depends on its position. In 342₁₀: the 3 means 3×100=300, the 4 means 4×10=40, the 2 means 2×1=2. In general, for base b: each digit d at position i contributes d×b^i. The same principle applies in any base. In 1A3₁₆ (hex): 1×256 + 10×16 + 3×1 = 256 + 160 + 3 = 419₁₀.
How do you convert decimal fractions to binary?
Use repeated multiplication by 2: multiply the fractional part by 2, record the integer part (0 or 1) as a binary digit, then continue with the remaining fractional part. Example: 0.6875₁₀: 0.6875×2=1.375 (digit 1), 0.375×2=0.75 (digit 0), 0.75×2=1.5 (digit 1), 0.5×2=1.0 (digit 1) → 0.1011₂. Not all decimal fractions terminate in binary (e.g., 0.1₁₀ is a repeating binary fraction).
What is base 36 and where is it used?
Base 36 uses digits 0–9 and letters A–Z (A=10, ..., Z=35). It's the largest single-character-per-digit base for case-insensitive alphanumeric representation. Base 36 is used in URL shorteners (for compact numeric IDs), vehicle identification numbers (VINs), and some database ID schemes where you want the largest alphabet without case sensitivity. Example: 1000₁₀ = RS₃₆.
How many bits does it take to represent a number?
The number of bits needed to represent a non-negative integer n is ⌊log₂(n)⌋ + 1 for n ≥ 1 (and 1 bit for n = 0). Examples: 0–1 needs 1 bit, 2–3 needs 2 bits, 4–7 needs 3 bits, 0–255 (a byte) needs 8 bits, 0–65535 needs 16 bits. For signed two's complement: one bit is used for the sign, so an 8-bit signed integer holds −128 to 127.