Toggle 32/64-bit grids. Click bits to flip them live and see decimal recalculate. Shows popcountll, clzll, ctzll, and MSB instantly.
Bit manipulation goes wrong in ways that are invisible in a debugger print. The Bit Visualizer lays a number out as a full-width grid of individually clickable bits, sized to fill the available screen rather than crouching in a narrow strip, so you can flip one and watch the decimal value, the popcount and the hex representation all move together.
Four cards report the GCC builtins competitive programmers actually reach for: __builtin_popcountll for set bits, __builtin_clz() for leading zeros, __builtin_ctz() for trailing zeros, and the position of the highest set bit. Seeing them recomputed as you toggle a bit is considerably faster than recompiling to find out.
Both a 32-bit and a 64-bit view are available. The 64-bit path works on a boolean array and decimal strings rather than on BigInt, which keeps the build target broad. That same decimal-string arithmetic drives each bit's place value and running total, so those two numbers stay exact across all 64 bits even past the point where the Decimal Value field itself starts to round.
42, which is 101010 in binary and gives a popcount of 3. Anything unparseable answers Enter a valid integer.42, hovering bit 5 (the highest of the three set bits) shows Sum before this bit (10) + this bit's value (32) = 42 — the running sum reaches the full decimal value exactly when you reach the highest set bit, not before.-1, not 4294967295.-1 lights every cell and -2 lights all but bit 0.— instead of a number. That mirrors the real builtins, which are undefined on an argument of zero.Decimal Value
42
Click a bit to flip it. Hover or tab a bit to load it into the HUD below. Index 0 = LSB (rightmost).
Bit Contribution HUD
Hover or tab a bit above to begin
Bit Position
—
Place Value
—
Status
—
Running Sum
—
__builtin_popcountll
3
Set bits
__builtin_clz()
26
Leading zeros
__builtin_ctz()
1
Trailing zeros
MSB position
5
Highest set bit
Binary
00000000000000000000000000101010Hexadecimal
0x0000002A