Programmer Calculator & Bitwise Calculator

Type one expression using 0x hex, 0b binary and 0o octal literals, the bitwise operators & | ^ ~, shifts << >> >>>, rotates, and plain arithmetic — the result updates live as decimal, hexadecimal, octal and binary at a word size of 8, 16, 32 or 64 bits, signed or unsigned. Below, a clickable bit grid, a two-operand bitwise panel (AND / OR / XOR / NAND / NOR / NOT / shifts / ROL / ROR) and single-bit set / clear / toggle. For plain base conversion without bit logic see the Math Converter; for statistics the Statistics Calculator.
Word size    View   Operators: & | ^ ~ << >> >>> + - * / % ( ) — integer math only, results wrap at the word size.
DEC
HEX
OCT
BIN
Bits are shown most-significant first; dimmed cells are outside the current word size.
bit index (0 = least significant)
A =    B =   A and B accept full expressions (e.g. 1 << 12).
The result table appears once A and B both parse. Shifts and rotates take the count from B.
Try an example:
How shifts behave: << masks back to the word size (bits that fall off the top are gone). >>> is always a logical (unsigned) shift. >> follows the View selector: arithmetic in signed mode, logical in unsigned mode. Privacy: the whole calculator runs in this tab — no server, no storage.

What is a programmer calculator?

A programmer calculator does arithmetic the way computers store it: in fixed-width words of bits. Instead of one endless number line, an 8-bit word is a circle of 256 values, a 32-bit word a circle of 4,294,967,296. Every result is wrapped back into that circle, and the same bits can be read as an unsigned count (0 … 255) or as a signed two's-complement value (-128 … 127). The four base rows above are the same bits rendered four ways — edit one and the other three follow.

Why programmers live in hexadecimal

One hex digit is exactly four bits, so a byte is always two hex digits, a 32-bit word always eight. Hex is binary with the zeros regrouped for human eyes:

BinaryHexDecimal
1111 11110xFF255
0001 01100x1622
1000 00000x80128 (or -128 signed)

Two's complement in one paragraph

To read a word as signed, look at the top bit. If it is 0, the value is just the unsigned count. If it is 1, subtract the circle size: an 8-bit 0xFF is 255 − 256 = −1. That is the whole trick — -x and 0 - x produce identical bits, which is why the same adder hardware works for both. The sign flip is "invert every bit, add 1": NOT(0x01) = 0xFE, +1 = 0xFF = −1.

The shift operators at a glance

OperatorName8-bit example (a = 0xF0)
a << 1left shift0xE0 — top bit falls off, zero enters at the bottom
a >> 1 (unsigned)logical right shift0x78 — zeros enter at the top
a >> 1 (signed, a = −16)arithmetic right shift0xF8 = −8 — the sign bit is copied
a >>> 1always logical0x78 regardless of the View selector
rol(a, 1)rotate left0xE1 — the fallen top bit re-enters at the bottom

Common mistakes this page helps you avoid

Arithmetic shift vs logical shift: copying the sign bit (arithmetic) and padding with zeros (logical) differ whenever the top bit is set — switch the View selector and watch 0xF0 >> 1 change between 0x78 and 0xF8.
The 53-bit surprise: JavaScript's ordinary Number type is a 64-bit float with only 53 safe integer bits, so 0xFFFFFFFFFFFFFFFF cannot be represented exactly — this page uses exact 64-bit integer arithmetic internally, so every hex digit you see is trustworthy.
Float traps: 0.1 + 0.2 famously gives 0.30000000000000004 in floating point; this calculator is integer-only by design — division truncates toward zero, exactly like C's / on ints.
Leading zeros: in old C a literal like 052 meant octal. Here decimal is plain digits and octal needs the 0o prefix, so nothing is ambiguous.

FAQ

What is the largest number? — 64-bit unsigned: 18,446,744,073,709,551,615 (0xFFFFFFFFFFFFFFFF); signed: ±9,223,372,036,854,775,808.
Why did 1 << 8 become 0? — the word size is 8 bits; bit 8 does not exist, and the mask drops it. Switch to 16/32/64 bit to keep it.
What does ~ do? — bitwise NOT: every bit flips inside the current word size, so ~0 is all-ones (255 / 65535 / −1 …).
Is there floating point? — no, integer-only; use the Scientific Calculator for floats, trig and functions.
Does anything leave my machine? — no: no server, no storage, no analytics; close the tab and everything is gone.