Number Base Calculator
Perform arithmetic (add, subtract, multiply, divide) in binary, octal, decimal, or hexadecimal. Includes bitwise operations (AND/OR/XOR), bit shift, and overflow detection.
Result (in selected base)
—
Result (decimal) —
Extended More scenarios, charts & detailed breakdown ▾
Result (in base)
—
Result (decimal) —
A in decimal —
B in decimal —
Professional Full parameters & maximum detail ▾
Result in All Bases
Result (decimal) —
Result (binary) —
Result (hex) —
Result (octal) —
Overflow & Complement
Overflow? —
2's Complement (if negative) —
How to Use This Calculator
- Enter Number A and Number B in the selected base (e.g., enter "1010" for binary 10).
- Select the base: Binary (2), Octal (8), Decimal (10), or Hex (16).
- Select the operation (add, subtract, multiply, divide).
- See the result in the selected base and in decimal.
- Use Bitwise tab for AND/OR/XOR/NOT operations.
- Use Bit Shift for left/right shift operations.
- The Professional tier adds 8/16/32-bit overflow detection and 2's complement.
Formula
Addition: Convert to decimal → operate → convert back to base
Bitwise AND: Each bit: 1 AND 1 = 1, else 0 • OR: 0 OR 0 = 0, else 1 • XOR: same bits = 0, different = 1
Left shift: n << k = n × 2^k • Right shift: n >> k = floor(n / 2^k)
Example
Example: Binary 1010 + 0110 = 10000 (10 + 6 = 16). Hex FF + 1 = 100 (255 + 1 = 256). Bitwise 12 AND 10 = 8 (1100 AND 1010 = 1000).
Frequently Asked Questions
- Binary addition follows the same rules as decimal but with base 2: 0+0=0, 0+1=1, 1+1=10 (0 carry 1). Example: 1010 + 0110 = 10000 (10 + 6 = 16 in decimal).
- Hex uses digits 0–9 and A–F (A=10, B=11, ..., F=15). Hex arithmetic works like decimal but carrying at 16. Example: F + 1 = 10 (hex) = 16 (decimal).
- AND compares each bit: 1 AND 1 = 1, any other combination = 0. Example: 12 (1100) AND 10 (1010) = 8 (1000). Used for masking bits.
- Left shifting a number by n bits multiplies it by 2^n. Example: 8 << 2 = 32 (8 × 4). Right shift divides by 2^n (integer division).
- 2's complement is the standard way to represent negative integers in binary. To get the 2's complement: invert all bits (1's complement) then add 1. For -5 in 8-bit: 00000101 → invert → 11111010 → add 1 → 11111011.