Binary Rotate Right Calculator – Free

This rotate right calculator applies a circular right shift to a binary word. Each bit that drops off the least significant end reappears at the most significant end.

How to use the Rotate right Calculator tool

  1. Type the word into the Binary digits field. Pad it with leading zeros to your register width first.
  2. Type the number of bit positions to rotate in the Number of positions field.
  3. Select Rotate right, or select Example to rotate 10110001 by 2.
  4. Read the result, shown at the same width as the input, in the Result box.
  5. Select Copy to copy the rotated word, or Clear to reset.

What a rotate right does

Rotating right by n moves every bit n places toward the low end. The n bits that would fall off the bottom are placed, in the same order, at the top. Unlike a right shift, which throws those bits away and inserts zeros, a rotation keeps the full contents of the word.

The tool takes the last n digits of your input and moves them to the front. The amount is first reduced modulo the word width, where the width is simply the number of digits entered. A rotation by a multiple of the width returns the same word.

Worked example: 10110001 rotated right by 2

The two lowest bits of 10110001 are 01. They wrap to the top, and the remaining six bits 101100 slide down behind them, giving 01101100. The leading zero is kept, so the result is still an 8-bit word. Rotating that result right by another 6 positions completes a full turn and restores 10110001.

10110001 ror 2   =  01101100
01101100 ror 6   =  10110001
00000001 ror 1   =  10000000
10110001 ror 12  =  00011011   (12 mod 8 = 4)

Rotate right in SHA-256 and on ARM

Right rotation is the workhorse of the SHA-2 family. SHA-256 defines its round functions as XORs of one 32-bit word rotated right by three different amounts: 2, 13 and 22 bits in one function, 6, 11 and 25 in another. BLAKE2b uses right rotations by 32, 24, 16 and 63 bits. When you implement or debug these, checking a single rotation by hand is a quick way to locate a mistake.

On ARM processors ROR is one of the barrel shifter operations, and classic 32-bit ARM encodes immediate constants as an 8-bit value rotated right by an even amount. x86 offers ROR, C++20 offers std::rotr and Rust offers rotate_right.

Limits and things to check

Most wrong results come from entering the word at the wrong width.

  • The word may be 1 to 65,536 binary digits. Spaces and a 0b prefix are removed before the width is measured.
  • The rotation amount must be a whole number from 0 to 4096.
  • A missing leading zero changes the width and therefore the answer. 0011 rotated right by 1 is 1001, but 11 rotated right by 1 is 11.
  • The input is treated as a raw bit pattern. There is no sign handling and no carry flag.

Frequently asked questions

What is the difference between rotate right and right shift?

A right shift discards the low bits and fills the top with zeros or sign bits. A right rotation moves the low bits to the top. After a rotation the word still contains every original bit.

Is rotating right by n the same as rotating left?

Yes, by the complementary amount. In a word of width w, a right rotation by n equals a left rotation by w - n. For 10110001, rotating right by 2 and rotating left by 6 both give 01101100.

Why does the result keep its leading zeros?

A rotation is defined on a fixed-width word, so every position matters. The calculator returns exactly as many digits as it received, which keeps the output aligned with the register you are modeling.

Can I rotate a 32-bit or 64-bit word?

Yes. Enter all 32 or 64 digits, including leading zeros. The tool handles words up to 65,536 bits, so standard register sizes and much wider test vectors both fit.

Does the tool support rotate through carry?

No. It performs a plain circular rotation of the entered bits. Instructions such as x86 RCR include the carry flag as an extra bit in the ring, which you would need to model by adding that bit to the word yourself.

Related tools