User Rating 0.0
Total Usage 0 times
Non-negative integer
Presets:
Is this tool helpful?

Your feedback helps us improve.

About

A left bit-shift moves every bit in a binary number n positions toward the most significant side, filling vacated positions with 0. The operation is equivalent to multiplying the original value by 2n. Getting the shift count wrong by even 1 doubles or halves your intended result. In embedded firmware and network protocol work this causes silent data corruption that passes unit tests but fails in production. Standard JavaScript bitwise operators truncate operands to 32-bit signed integers, meaning any value above 231 1 overflows without warning. This tool uses arbitrary-precision arithmetic via BigInt, so you can shift a 256-bit cryptographic key left by 128 positions and still get the exact answer.

Results are displayed simultaneously in binary, decimal, hexadecimal, and octal. Bit-width markers flag when your result exceeds common register sizes (8, 16, 32, 64 bits). Note: this tool operates on unsigned magnitudes. For signed two's complement interpretation at a specific width, consult the reference table below for range limits.

binary bit shift left shift bitwise operations binary calculator bit manipulation

Formulas

The left bit-shift operator takes an integer value and a non-negative shift count, producing a new integer whose binary representation is the original bits moved leftward with zeros inserted on the right.

result = value << n = value × 2n

Where value is the input integer (unsigned magnitude), n is the shift count (number of bit positions to shift left), and result is the output integer. The bit length of the result is computed as:

bitsresult = floor(log2(value)) + 1 + n

For a specific register width w, the masked result under unsigned interpretation is:

resultw = (value << n) mod 2w

Overflow occurs when bitsresult > w. This tool does not truncate. It computes the full arbitrary-precision result and flags which standard widths would overflow.

Reference Data

Bit WidthUnsigned RangeSigned Range (Two's Complement)Max Left Shift from 1Common Use
4 bits0 - 15−8 - 73Nibble, BCD digit
8 bits0 - 255−128 - 1277Byte, ASCII, I2C registers
16 bits0 - 65,535−32,768 - 32,76715short int, UTF-16 code unit
32 bits0 - 4,294,967,295−2,147,483,648 - 2,147,483,64731int32, IPv4 address, IEEE 754 float
64 bits0 - 18,446,744,073,709,551,615−9.22 × 1018 - 9.22 × 101863long, pointer, timestamp (ns)
128 bits0 - 3.40 × 1038−1.70 × 1038 - 1.70 × 1038127UUID, IPv6 address, AES block
256 bits0 - 1.16 × 1077−5.79 × 1076 - 5.79 × 1076255SHA-256 hash, secp256k1 private key
512 bits0 - 1.34 × 10154 - 511SHA-512 hash
1024 bits0 - 1.80 × 10308 - 1023RSA key (legacy)
2048 bits0 - 3.23 × 10616 - 2047RSA key (standard)
Common Shift Equivalences
<< 1Multiply by 2
<< 2Multiply by 4
<< 3Multiply by 8
<< 4Multiply by 16 (shift one nibble)
<< 8Multiply by 256 (shift one byte)
<< 10Multiply by 1,024 (KiB boundary)
<< 16Multiply by 65,536 (shift one word)
<< 20Multiply by 1,048,576 (MiB boundary)
<< 24Multiply by 16,777,216 (RGB channel shift)
<< 32Multiply by 4,294,967,296 (shift one dword)

Frequently Asked Questions

JavaScript's << operator converts both operands to 32-bit signed integers before operating. Any value outside the range −2,147,483,648 to 2,147,483,647 is silently truncated. Additionally, the shift count is masked to 5 bits (modulo 32), so shifting by 33 is identical to shifting by 1. This tool uses BigInt arithmetic, which has no bit-width limit.
In a fixed-width signed register of w bits, the most significant bit is the sign bit. Left-shifting can push a 1 into that position, turning a positive number negative. For example, 1 << 7 in an 8-bit signed register yields −128, not 128. This tool operates on unsigned magnitudes by default. Consult the reference table for signed range limits at each width.
For arbitrary-precision (unbounded) integers, yes: x << n x × 2n. For fixed-width registers, this holds only when no bits are shifted out beyond the register width. Once overflow occurs, the upper bits are lost and the equivalence breaks.
The tool accepts shift counts from 0 to 1024. Shifting by 0 returns the original value. Shifting 1 left by 1024 produces a number with 1025 binary digits. BigInt handles this without precision loss. Values beyond 1024 are rejected to prevent browser memory issues with extremely large output strings.
Yes. Toggle the input mode to Binary and enter a string of 0s and 1s directly. The tool strips any spaces or underscores used as visual separators. Leading zeros are preserved in the display but do not affect the computed value.
In a 24-bit RGB value, the red channel occupies bits 16 - 23, green occupies bits 8 - 15, and blue occupies bits 0 - 7. To place a red value of 255 into position: 255 << 16 = 16,711,680 (hex 0xFF0000). Combine channels with bitwise OR.