Math
Bit Shift Calculator
Shifting moves every bit left or right.
Left shifts multiply by 2 per position; right shifts divide by 2, and the difference between a logical and an arithmetic right shift is what fills the empty left bits. Enter a value, pick the shift, and see the before/after bit rows, the bits that fell off, and whether the result overflowed.
Negative decimals are stored in two's complement at the chosen width, which is what makes the two right shifts differ.
How many positions to move. Each position is one factor of 2.
How many bits the register holds. 8-bit is a byte; 32-bit and 64-bit match most programming languages.
Try an example
Result
Shifted bits
—
- Unsigned value
- —
- Signed value
- —
- Hexadecimal
- —
Student quick launch
Grade planning, algebra checks, and formulas students reach for most.
Study path
Use this calculator with
Follow these when you want the formula behind the answer, a short lesson, or nearby tools in the same topic.
What the bit shift calculator solves
Because binary place values double from right to left, moving bits one place left doubles the number and moving them right halves it. Processors use shifts as the fastest way to multiply or divide by powers of two and to pack fields into registers. The catch is the register width: bits that leave the register are gone, and right shifts must decide what to put in the vacated sign position.
The three shifts
| Shift | Fills with | Numeric effect | 8-bit example |
|---|---|---|---|
| Left (<<) | 0s on the right | × 2^n (may overflow) | 00000101 << 2 = 00010100 (5 → 20) |
| Logical right (>>>) | 0s on the left | unsigned ÷ 2^n, rounding down | 11111000 >>> 1 = 01111100 (248 → 124) |
| Arithmetic right (>>) | copies of the sign bit | signed ÷ 2^n, rounding toward −∞ | 11111000 >> 1 = 11111100 (−8 → −4) |
How to use it
- Choose the shift type. Use arithmetic right for signed integers (Java >>, C on signed types) and logical right for unsigned (Java >>>).
- Enter the value in the chosen format and pick the register width.
- Set the number of positions to shift.
- Compare the input and output bit rows; the highlighted bits are the result and the dropped bits are listed.
How to read the answer
The result is shown as bits, as an unsigned number, and as a signed number. For left shifts, check the overflow flag: a lost 1 bit means the multiplication did not fit. For right shifts, the interpretation line states the division and how it rounded.
Common mistakes and edge cases
- Using a logical right shift on a negative number: the sign bit becomes 0 and −8 turns into a large positive value.
- Expecting −7 >> 1 to be −3. Arithmetic shifts round toward negative infinity, so the answer is −4.
- Shifting by the width or more: in this calculator every bit is cleared (or filled with the sign); some CPUs instead use the count The remainder left over after dividing one whole number by another. the width.
- Left shifting can change the sign bit without losing a 1, which flips the signed reading; the calculator warns when that happens.
- A shift by 0 returns the value unchanged.
Worked examples
Left shift multiplies
5 << 2 at 8 bits
Shifted bits
00010100
Left shift overflow
200 << 1 at 8 bits
Shifted bits
10010000
Arithmetic right keeps the sign
−8 >> 1 at 8 bits
Shifted bits
11111100
Logical right clears the sign
−8 >>> 1 at 8 bits
Shifted bits
01111100
Rounding toward −∞
−7 >> 1 at 8 bits
Shifted bits
11111100
Hex input
0xF0 >>> 4 at 8 bits
Shifted bits
00001111
Shift by zero
1010 << 0 (binary input)
Shifted bits
00001010
Does not fit
70000 << 1 at 16 bits
Shifted bits
—
Frequently asked questions
What does shifting left do to a number?+
Each left shift doubles it: x << n = x × 2^n. 5 << 2 = 20. If a 1 bit is pushed out of the register the result overflows and wraps.
What is the difference between logical and arithmetic right shift?+
Both move bits right and drop the low bits. A logical shift fills the empty high bits with 0; an arithmetic shift fills them with copies of the sign bit so negative numbers stay negative.
Why is −7 >> 1 equal to −4 and not −3?+
An arithmetic right shift is a floor division by 2. −7 ÷ 2 = −3.5, and the floor of −3.5 is −4. Truncating division (as in C's −7 / 2) would give −3, so shifts and division differ for negative odd numbers.
Which operator does my language use?+
Java and JavaScript have >> (arithmetic) and >>> (logical). C and C++ use >> for both; it is logical on unsigned types and usually arithmetic on signed types. Python's >> is arithmetic on unbounded integers.
What happens if I shift by more than the width?+
Every bit falls off, leaving 0 (or all sign bits for an arithmetic right shift). Real hardware may instead use the count modulo the width, so avoid relying on it.
About this calculator
- Written by
- mathcheck editorial team
- Last reviewed
- September 4, 2026
Method
- Uses the values entered by the user and stable formulas documented on the page.
Related calculators
Bitwise Calculator
AND, OR, XOR, NOT, NAND, and NOR on binary, decimal, octal, or hex inputs at 4 to 64 bits, with an aligned bit grid, a bit-by-bit truth table, and the result in every base.
Two's Complement Calculator
Convert decimal to two's complement and back at 4, 8, 16, 32, or 64 bits with the invert-and-add-1 steps, the sign bit highlighted, overflow detection, and the unsigned reading of the same bits.
Binary Multiplication Calculator
Multiply binary numbers with every shifted partial product listed in an aligned grid, then the final sum, plus the product in decimal, hex, and octal.
Binary Division Calculator
Divide binary numbers with the long-division tableau drawn out, the remainder shown, optional fraction bits past the binary point, and a decimal check.
Binary to Decimal Converter
Convert binary to decimal with the positional-weight table (bit × 2^n), fractional bits after the binary point, and an option to read the bits as a signed two's complement number.
Binary Calculator
Add, subtract, multiply, or divide binary numbers with the column method shown: carries, borrows, partial products, and a long-division tableau, plus decimal, hex, and octal equivalents.
Last updated: September 4, 2026