Calculators

Binary Rotation Calculator

Rotate binary bits left or right within a fixed word width, preserving leading zeros and showing exact unsigned decimal results.

Rotate 1 to 4096 bits left or right. Bits wrap around within the entered width; leading zeros count. The rotation count is reduced modulo the width. Calculations stay in your browser.

Enter binary digits and a rotation count.

How binary rotation works

Binary rotation moves bits around a fixed-width word. Bits leaving one end re-enter at the other end. Rotating 1011 left by 1 gives 0111 (decimal 7); rotating it right by 1 gives 1101 (decimal 13). Leading zeros define the width: 0011 rotated left by 1 is 0110. A count of zero or any multiple of the width leaves the word unchanged. Counts are reduced modulo the width, so rotating four bits by 5 is equivalent to rotating by 1. Enter 1 to 4096 binary digits and a nonnegative decimal count of up to 1000 digits. Surrounding whitespace and leading zeros in the count are accepted. Prefixes, internal spaces, signs, fractions and scientific notation are rejected. This is a circular rotation without a carry bit, rather than a shift that discards bits and inserts zeros. Results use unsigned interpretation with no 32-bit truncation. All processing stays in your browser.

Frequently Asked Questions

Everything you need to know about this tool, how it works, and privacy.

How is rotation different from shifting?

Rotation wraps bits from one end to the other. A logical shift discards those bits and inserts zeros.

Do leading zeros matter?

Yes. They define the word width. Rotating 0011 left by one gives 0110, while rotating 11 gives 11.

What happens with a large rotation count?

The count is reduced modulo the word width. For a four-bit word, counts of 1 and 5 produce the same result.

Are negative counts supported?

No. Choose the opposite direction and enter a nonnegative whole count instead.

Does this rotate through a carry flag?

No. Only the entered word is rotated. There is no extra carry bit or signed interpretation.