Left Logical Shift Calculator

Written by:
PK

Use this left shift calculator to shift bits left and multiply by powers of 2. Each position shifted left doubles the number.

Left logical shift calculator

Using the calculator

Enter the number to shift and select an input format: Decimal, Hex, Binary, or Octal. You can also type prefixes directly (0xFF for hex, 0b1010 for binary, or 0o17 for octal) and the tool will auto-detect the format. The positions field is always in decimal.

The result displays in all formats simultaneously: decimal (signed and unsigned), hexadecimal, octal, and a 32-bit binary representation with spaces every 8 bits for readability.

How left shift works

Left shift (<<) moves all bits to the left by a specified number of positions, filling the rightmost positions with zeros. Each shift left effectively multiplies the number by 2:

x \ll n = x \times 2^n

Unlike right shift, there is no "logical" vs "arithmetic" distinction for left shift - both operations are identical. Zeros always fill in from the right.

Left shift examples

44 \ll 2 = 176

Shifting 44 left by 2 positions multiplies it by 4 (2²). In binary:

0010110010110000

1 \ll 10 = 1024

Left shifting 1 by n positions gives you 2n. This is a fast way to calculate powers of 2 in programming.

Common uses for left shift

Left shift is commonly used for:

  • Fast multiplication by powers of 2
  • Creating bit masks - 1 << n creates a mask with only bit n set
  • Packing values - combining RGB: (red << 16) | (green << 8) | blue

Related calculators

      

PK

PK started DQYDJ in 2009 to research and discuss finance and investing and help answer financial questions. He's expanded DQYDJ to build visualizations, calculators, and interactive tools.

PK lives in New Hampshire with his wife, kids, and dog.

Don't Quit Your Day Job...

DQYDJ may be compensated by our partners if you make purchases through links. See our disclosures page. As an Amazon Associate we earn from qualifying purchases.
Sign Up For Emails
linkedin facebook pinterest youtube rss twitter instagram facebook-blank rss-blank linkedin-blank pinterest youtube twitter instagram