Base Converter & Bitwise Calculator

Simultaneous two-way conversion between Binary, Octal, Decimal, Hexadecimal, and arbitrary bases (2 to 36). Features BigInt arbitrary precision, signed two's complement modes, interactive 32-bit toggle matrix, and multi-operand bitwise logic calculator. 100% client-side.
Decimal (Base 10) DEC
Hexadecimal (Base 16) HEX
Binary (Base 2) BIN
Octal (Base 8) OCT
Custom Radix (Base 2 - 36)
Interactive Bit Visualizer (Bits 31 → 0)
Click any bit to toggle state. Updates all bases instantly.
Bitwise Operations Calculator
Perform bitwise AND, OR, XOR, NOT, NAND, NOR, and bit shifts between two operands:
Operand A: 0000 0000 0000 0000 0000 0000 0011 1100 0x0000003C (60)
Operand B (&): 0000 0000 0000 0000 0000 0000 0000 1101 0x0000000D (13)
= Result: 0000 0000 0000 0000 0000 0000 0000 1100 0x0000000C (12)

The Definitive Guide to Number Bases & Bitwise Computation

In low-level software engineering, embedded systems, networking protocols, and cryptography, data is rarely stored in the human decimal system. Computers operate fundamentally on voltage levels represented as binary switches (0 and 1). Understanding the mathematical relationships between Binary (Base 2), Octal (Base 8), Decimal (Base 10), and Hexadecimal (Base 16) is a prerequisite for understanding memory layouts, CPU registers, and network packet structures.

1. Positional Numeral Systems & Radix Mathematics

A positional numeral system represents any real number as an ordered sequence of digits multiplied by ascending powers of a radix base $b$:

$$\text{Value} = \sum_{i=0}^{n-1} d_i \cdot b^i = d_{n-1} b^{n-1} + \dots + d_1 b^1 + d_0 b^0$$

Because powers of 2 align perfectly with grouping boundaries:

2. Signed Integers & Two's Complement Arithmetic

In digital circuitry, hardware addition and subtraction units are unified using Two's Complement representation. For an $N$-bit integer system:

$$\text{Negate}(X) = (\sim X) + 1$$

For example, in an 8-bit signed integer space: $+5 = 0000\,0101_2$. Inverting the bits yields $1111\,1010_2$. Adding 1 yields $1111\,1011_2 = -5_{10}$.

3. Bitwise Logic Operations Reference

Operation Operator Logic Equation Common Systems Applications
Bitwise AND & 1 if both bits are 1 Masking bits, clearing specific flags (x & ~0x04), subnet masking.
Bitwise OR | 1 if either bit is 1 Setting flags or combining options (O_RDWR | O_CREAT).
Bitwise XOR ^ 1 if bits are different Toggling bits, parity checks, one-time pads, cryptographic ciphers.
Bitwise NOT ~ Inverts 0 to 1 and 1 to 0 Creating bitwise inverse masks.
Left Shift << Shifts bits left, fills with 0 Rapid multiplication by powers of 2 ($x \times 2^k$), constructing bitmasks (1 << n).
Arithmetic Right Shift >> Shifts bits right, preserves sign bit Division of signed numbers by powers of 2.
Logical Right Shift >>> Shifts bits right, fills with 0 Unsigned division and bit extraction.

4. JavaScript Bitwise Quirks & Arbitrary Precision

Standard JavaScript numbers are IEEE 754 double-precision 64-bit floating point numbers. When performing standard bitwise operations (such as a | b or a << 2), JavaScript implicitly casts operands to signed 32-bit big-endian integers via the ECMAScript ToInt32 abstract operation. This causes values greater than $2^{31}-1$ to wrap to negative numbers.

To avoid this precision truncation, our converter leverages the browser-native BigInt engine, allowing accurate calculations across 64-bit, 128-bit, 256-bit, and arbitrary bit boundaries without numeric degradation.

Frequently Asked Questions

Why does hex 0xFFFFFFFF represent -1 in 32-bit signed mode?
In a 32-bit two's complement system, every bit set to 1 represents $-2^{31} + (2^{30} + 2^{29} + \dots + 2^0) = -2,147,483,648 + 2,147,483,647 = -1$. In unsigned mode, that exact same binary sequence represents $4,294,967,295$.
What is the difference between >> and >>> in bit shifting?
The double shift >> is an arithmetic (sign-propagating) right shift: if the top bit is 1, it copies 1s into the left side, preserving negative numbers. The triple shift >>> is a logical (zero-fill) right shift: it always inserts 0s from the left, treating the input as an unsigned integer.
How do I test if a specific bit $n$ is set in C/C++/Java?
Use the mask formula bool isSet = (value & (1 << n)) != 0; where $n$ is the 0-indexed bit position.
Copied to clipboard!

We use cookies to enhance your experience. Optional cookies only run if you consent. See our Privacy Policy.