Bit Shift Calculator
Shifting left multiplies. Shifting right truncates.
Work out Bit Shift. Shifting left multiplies. Shifting right truncates. Shows the working, not just the answer.
Result
20
× 2^2 = × 4
Shifting left by n multiplies by 2ⁿ; shifting right divides by it. That equivalence is why compilers turn multiplication and division by powers of two into shifts — a shift is a single fast instruction where a divide is one of the slowest. Right shifts truncate rather than round, so 7 » 1 is 3 and not 3.5. The bits that fall off the right are the remainder, discarded, which means the result rounds toward zero for positive numbers. Left shifts push bits off the top of the register and lose them. Shifting 200 left by 2 in an 8-bit register does not give 800 — it wraps, because the high bits have nowhere to go. That is the classic source of silent overflow bugs in embedded code.
How the Bit Shift Calculator works
Left and right shifts with the arithmetic they are equivalent to and the bits lost off each end. Shifting left by n multiplies by 2ⁿ, which is why compilers turn power-of-two arithmetic into shifts.
Also known as: left shift right shift calculator · why does shifting multiply · binary shift operator · shift instead of divide
Frequently asked questions
What does shifting left do?
Multiplies by 2 for each place shifted. 5 « 2 is 20, because it is 5 × 4. Bits pushed past the register width are lost.
What does shifting right do?
Divides by 2 for each place, truncating rather than rounding. 7 » 1 is 3, not 3.5, because the bits falling off the end are the remainder and they are discarded.
Why do compilers use shifts?
A shift is a single fast instruction where a divide is one of the slowest. Any multiplication or division by a power of two gets converted automatically.
What is the difference between arithmetic and logical right shift?
An arithmetic shift preserves the sign bit for negative numbers; a logical shift fills with zeros. In most languages » is arithmetic on signed types and »> is logical.
How do shifts cause bugs?
By silently losing high bits. Shifting 200 left by 2 in an 8-bit register does not give 800 — it wraps, and nothing warns you. It is a classic source of embedded overflow bugs.
Put this calculator on your own site
Free to use, on any site, commercial or not. Paste this where you want it to appear. It is a plain iframe, so it works in WordPress, Squarespace, Wix, Webflow, Ghost and anything else that accepts HTML.
<iframe src="https://www.thecalclibrary.com/embed/bit-shift-calculator" width="100%" height="640" style="border:1px solid #e2e8f0;border-radius:12px" loading="lazy" title="Bit Shift Calculator"></iframe>
<p style="font:13px/1.5 system-ui,sans-serif;margin:6px 0 0;color:#64748b">Powered by <a href="https://www.thecalclibrary.com/bit-shift-calculator" style="color:#64748b">Bit Shift Calculator</a> from The Calc Library</p>The only condition is that the credit line below the frame stays in place. That one line is what pays for the tool being free — it is how anyone else finds it.