Bit Shift Calculator
Enter an integer and a shift amount to compute its bitwise shift.
Result
How it is calculated
The value is rounded to a whole number and shifted by the chosen number of bit positions in a signed 64-bit integer. Left shift: result = value × 2n. Right shift: result = floor(value ÷ 2n), an arithmetic shift that keeps the sign, so negatives round toward minus infinity (-7 shifted right by 1 gives -4).
The shift amount n must be a whole number from 0 to 63, and the value must not exceed 253 in size. A left shift that would overflow the signed 64-bit range (for example 1 shifted left by 63) returns no result instead of wrapping. Negative results are shown in decimal with a minus sign, but the hex and binary rows show the 64-bit two's-complement pattern, so -5 appears as 0xFFFFFFFFFFFFFFFB.
Worked example
Shift 13 left by 3 positions. In binary 13 is 1101. Moving every bit three places to the left and filling the right with zeros gives 1101000. That equals 13 × 23 = 13 × 8 = 104. The tool also shows the hexadecimal form 0x68 (6 × 16 + 8 = 104) and the binary form 0b1101000.
Common mistakes
- Expecting a right shift of a negative number to round toward zero: it rounds down, so -7 >> 1 is -4, not -3.
- Reading the hex and binary rows of a negative result as the number's magnitude: they are the 64-bit two's-complement pattern, which is why -5 shows a long run of F's and 1s.
- Entering a shift of 64 or more, or a negative shift, and expecting it to wrap around: the tool only accepts 0 to 63 and gives no result outside that range.
- Assuming a left shift is always the same as multiplying by 2n: that holds only while the result fits in a signed 64-bit integer, and 1 shifted left by 63 is rejected.
- Typing a decimal value such as 13.6 and expecting a fractional result: bit shifts work on integers, so the input is rounded to 14 first.
About this calculator
A bitwise shift moves every bit in an integer's binary representation left or right by a given number of positions. A left shift (<<) inserts zero bits on the right and is equivalent to multiplying by 2ⁿ; a right shift (>>) drops bits off the right and is equivalent to integer division by 2ⁿ; for negative numbers this tool, like most languages, uses an arithmetic shift, which keeps the sign bit (rounding toward minus infinity). This tool applies either operation to your integer and shows the result in decimal, hexadecimal and binary side by side.
Software engineers, embedded systems developers and computer science students use bit shifts constantly for fast power-of-two arithmetic, packing multiple values into a single integer (flags, RGB color channels, network protocol headers), and implementing hash functions or checksums — operations like CRC and many cryptographic primitives are built almost entirely from shifts and XORs because they execute in a single CPU cycle, far faster than a general multiply or divide.
Was this helpful?
You can pick up to 3 reactions.
Popular calculators
Loan Calculator
Monthly payment, total interest and full amortization schedule.
Percentage Calculator
Percent change, percent of, and ratio calculations.
Discount Calculator
Calculate final price, savings, and discount amount.
BMI Calculator
Body mass index from height and weight (metric or imperial).
Age Calculator
Compute your exact age in years, months and days from a birth date.
Compound Interest Calculator
Calculate the final amount and interest earned with compounding.
All Calculators
- Loan Calculator
- Profit Calculator
- Discount Calculator
- BMI Calculator
- Percentage Calculator
- Ideal Weight Calculator
- Age Calculator
- Pregnancy Due Date Calculator
- Compound Interest Calculator
- BMR Calculator (Basal Metabolic Rate)
- Tip Calculator
- Fuel Cost Calculator
- Date Difference Calculator
- Sleep Cycle Calculator
- Daily Water Intake Calculator
- Simple Interest Calculator
- Heart Rate Zones Calculator
- Running Pace Calculator
- Pet Age Calculator
- Calories Burned Calculator
- Macro Calculator
- TDEE Calculator (Total Daily Energy Expenditure)
- Waist-to-Hip Ratio Calculator
- Honor Roll Calculator
- One Rep Max (1RM) Calculator
- Ovulation Calculator
- Electricity Cost Calculator
- Unit Price Calculator
- Savings Goal Calculator
- Break-Even Point Calculator
- Paint Calculator
- Course Grade Average Calculator
- Business Days Calculator
- Time Duration Calculator
- Fuel Economy Calculator
- Temperature Converter
- Tile Calculator
- Aspect Ratio Calculator
- Roman Numeral Converter
- Goal Weight Timeline Calculator
- Salary Converter (Hourly to Annual)
- Credit Card Validator (Luhn)
- Body Surface Area (BSA) Calculator
- Feels-Like Temperature Calculator
- Ohm’s Law Calculator
- PPI (Pixel Density) Calculator
- Molar Mass Calculator
- Zodiac Sign Calculator (Western + Chinese)
- IBAN Validator
- Shoe Size Converter
- Country Info & Dialing Code Lookup
- Time Zone Difference (World Clock)
- CAGR (Compound Annual Growth Rate) Calculator
- Rule of 72 Calculator
- Blood Alcohol Content (BAC) Calculator
- Lean Body Mass (LBM) Calculator
- Pythagorean Theorem Calculator
- Speed Converter
- Download Time Calculator
- Date Calculator (Add/Subtract)
No calculators found
Comments (1)
This calculator works in a signed 64-bit integer, which matters when you compare with code you wrote elsewhere. Shifting 1 left by 31 gives 2147483648 here, while a 32-bit signed integer in C or JavaScript wraps that into a negative number. A left shift that would overflow 64 bits returns nothing instead of wrapping. If your result differs from your program, check the integer width first. Which language are you checking against?