Binary & Hex Calculator
Perform arithmetic and bitwise operations on binary, octal, decimal, and hex numbers. Converts between all bases instantly.
Base Converter
Arithmetic
Prefix inputs with 0b (binary), 0o (octal), 0x (hex) — or plain decimal.
Bitwise Operations
What Is a Binary & Hex Calculator?
A binary and hexadecimal calculator lets you perform arithmetic (add, subtract, multiply, divide) and bitwise operations (AND, OR, XOR, NOT, shifts) on numbers in any base — binary (base 2), octal (base 8), decimal (base 10), or hexadecimal (base 16). It is essential for low-level programming, embedded systems, network masks, and understanding how computers represent data.
How to Use
- Converter: Type a number in any base and see it converted to all other bases instantly
- Arithmetic: Enter two numbers (with optional
0b/0xprefixes), pick an operator, and see the result - Bitwise: Apply AND, OR, XOR, NOT, left shift, or right shift with a configurable bit width
- All results are shown in binary, decimal, hex, and octal simultaneously
Features
- Base converter: binary ↔ octal ↔ decimal ↔ hex in real time
- Arithmetic: addition, subtraction, multiplication, integer division — inputs in any base
- Bitwise: AND, OR, XOR, NOT, left shift, right shift with 8/16/32/64-bit width control
- Bitwise result shown as grouped binary (4 bits per group) for easy reading
- Uses JavaScript BigInt — no overflow for large numbers
- Auto-detects input base via
0b,0o,0xprefixes
FAQ
What are bitwise operators used for?
Bitwise operators manipulate individual bits. Common uses include: applying subnet masks (AND), setting flags (OR), toggling bits (XOR), inverting all bits (NOT), and fast multiplication/division by powers of two (LSHIFT/RSHIFT).
Why does NOT produce a large number?
NOT inverts every bit within the selected bit width. So NOT 0 with 8 bits =11111111 = 255. Changing the bit width (8/16/32/64) changes the result because more bits are included in the inversion.
Can I mix input bases in arithmetic?
Yes. The arithmetic section auto-detects the base of each operand from its prefix (0b = binary, 0x = hex, 0o = octal, no prefix = decimal). So you can add 0xFF and 0b1010 directly.
How do I convert a hex color to decimal?
Type the hex value (e.g., FF8C00) in the converter with base set to Hex — the decimal and binary equivalents appear instantly. For individual color channels, convert each 2-digit hex pair separately.