Shift a value left or right and see the bits move – logical shifts insert zeros, arithmetic right shift copies the sign bit, and every shift is a multiply or divide by two.
Show calculation steps
Processed privately in your browser — nothing you paste is uploaded, logged or stored.
Three shifts, three meanings
Left shift multiplies by two per step, zeros entering on the right and high bits falling off the chosen width. Logical right shift divides unsigned values, zeros entering left. Arithmetic right shift preserves SIGN by copying the top bit — the correct divide-by-two for two’s-complement values.
This calculator shows before/after patterns with unsigned, signed and hex readings, so each shift’s meaning is visible rather than memorised.
Worked example
10010110 (8-bit) <<1 → 00101100 (top bit lost: 150×2 mod 256 = 44) >>>2 → 00100101 (unsigned 150 ÷ 4 = 37) >>2 → 11100101 (signed −106 ÷ 4 → −27, sign kept)
| Shift | Semantics | Numeric effect |
|---|---|---|
| << n | zeros enter right | × 2ⁿ (truncated to width) |
| >>> n | zeros enter left | unsigned ÷ 2ⁿ |
| >> n | sign bit copies in | signed ÷ 2ⁿ toward −∞ |
Language traps
JavaScript has both >> (arithmetic) and >>> (logical); C leaves right-shifting negatives implementation-defined; Java matches JavaScript. Cross-language bit code fails exactly here — previewing both behaviours on your value is cheaper than the debugger session.
Shifts as structure
Beyond ×2/÷2, shifts build field extraction ((value >> pos) & mask) and flag construction (1 << n). The Bitmask Calculator next door completes that toolkit.
Privacy
Shifting runs locally; patterns are never transmitted.
How to use the Binary Bit Shift Calculator
- Enter the value (binary, decimal or hex – set the input base).
- Choose shift type – left, logical right, or arithmetic right – and the shift amount and width.
- Click "Shift bits".
- Before/after patterns are shown with unsigned, signed and hex readings of the result.
Frequently asked questions
What do the three shift types do differently?
Left shift moves bits left, zeros entering on the right (×2 per step, mod the width). Logical right shifts in zeros from the left (unsigned ÷2). Arithmetic right copies the SIGN bit into vacated positions, preserving negativity – the >> of signed integers.
Why does a left shift multiply by two?
Every bit's place value doubles when it moves one position left – the whole value doubles. n shifts multiply by 2ⁿ until bits fall off the fixed width, at which point wraparound-style truncation appears, exactly as shown.
When do I need arithmetic vs logical right shift?
Arithmetic for signed values (−8 >> 1 should be −4, needing sign copies), logical for unsigned bit fields and masks. Languages differ: JavaScript has both >> and >>>, C leaves signed right shift implementation-defined – the calculator shows both honestly.
What happens to bits shifted off the end?
They are gone – shifting is lossy at fixed width. Left-shifting 10010110 by 1 at 8 bits drops the leading 1: the result 00101100 is NOT double the original (150×2 ≠ 44); the steps flag the loss.
Is shifting really faster than multiplying?
On modern CPUs both are single-cycle, but shifts express INTENT for power-of-two scaling and bit-field extraction. Compilers interconvert freely; humans should write the meaning.
What is a rotate, and is it here?
Rotation wraps the departing bit to the other end (no loss). This page implements shifts; rotation is a distinct operation worth its own exploration – shifting twice through the width zeroes a register, rotating never does.
Are shifts computed locally?
Yes – patterns are shifted in-page and never transmitted.