Code tool

Circularly Shift a Binary Number

Enter a binary bit string, choose a direction and shift count, and rotate its bits locally without signed arithmetic.

In-browser processingNo account requiredPrivacy details ↗

Use only 0 and 1. The exact width and leading zeros are preserved.

The count is reduced modulo the bit width.

Enter a binary number to begin.

This is a circular shift of the bit string; it does not use signed arithmetic.

A QUICK WALKTHROUGH

How to use this tool

  1. Enter 1–10,000 bits containing only 0 and 1.
  2. Choose left or right and enter a non-negative shift count.
  3. Shift the bits and copy the result with its original width.

Fixed-width bit strings

The output always has exactly the input width, including leading zeroes.

Modulo shift counts

The count is reduced modulo the bit width, so a full-width shift returns the original string.

String-based arithmetic

Bits are rotated as characters. The tool never parses a signed integer or applies two’s-complement rules.

GOOD TO KNOW

Common questions

Are leading zeroes preserved?

Yes. The result keeps the exact number of input bits.

What happens when the count is larger than the width?

It is reduced modulo the width.

Does this use signed arithmetic?

No. It operates on the bit string locally in your browser.