How to use the Bit reversal Calculator tool
- Enter the word in the Binary digits box, with leading zeros up to the width you intend to reverse.
- Select Convert to mirror the bit order.
- Read the reversed word in the Result box. It has the same length as the input and no spaces.
- Select Copy to take the result, or Example to reverse 01001101.
What bit reversal means
Bit reversal changes positions, not values. Bit 0 trades places with bit n-1, bit 1 with bit n-2, and so on. A word with three 1 bits still has three 1 bits afterward. Reversing twice returns the original word, and a palindrome such as 10000001 is unchanged.
It is easy to confuse with two other operations. Bitwise NOT keeps positions and flips values. A byte order swap moves whole bytes but keeps the bits inside each byte in order. The Binary Endianness Converter does the byte swap. This tool reverses down to the single bit.
Worked example: reversing bits at a fixed width
The sample 01001101 reversed is 10110010. By coincidence that is also the bitwise inverse of the sample, so a clearer test is 0001, which reverses to 1000 while its inverse would be 1110.
Width changes the outcome. The value six entered as 110 reverses to 011. Entered as the byte 00000110 it reverses to 01100000. Always type the full word, because the leading zeros become trailing zeros.
01001101 -> 10110010
0001 -> 1000
110 -> 011
00000110 -> 01100000
10110000 -> 00001101Where bit reversal is used
Reversing bit order is a routine step in several areas of low-level work.
- Fast Fourier transforms. Radix-2 FFT code reorders samples by bit-reversed index, so in an 8-point transform index 3 (011) swaps with index 6 (110).
- Reflected CRCs. The CRC-32 polynomial 04C11DB7 reversed over 32 bits is EDB88320, the constant seen in most software implementations.
- Serial links. UART sends the least significant bit first while I2C sends the most significant bit first, so captured bits may need mirroring.
- Graphics. Mirroring a 1-bit-per-pixel glyph row horizontally is a bit reversal of that row.
Input rules
The calculator accepts 1 to 65,536 binary digits. Whitespace is removed before reversing, so grouped input is reversed as one continuous word and the output is not regrouped. A 0b prefix at the start is stripped and not added back. The whole input is one word. To reverse the bits of each byte separately, run the bytes one at a time.
Frequently asked questions
Is bit reversal the same as inverting bits?
No. Inverting turns each 0 into 1 and each 1 into 0 without moving anything. Reversal moves bits to mirrored positions without changing them. 0001 inverts to 1110 but reverses to 1000.
Is reversing bits the same as swapping endianness?
No. An endianness swap reverses the order of bytes and leaves each byte intact. Bit reversal also reverses the bits inside every byte. For 00000001 00000000, a byte swap gives 00000000 00000001 and a bit reversal gives 00000000 10000000.
Why do leading zeros matter for bit reversal?
They define the word width, and after reversal they sit at the right end where they multiply the value. 11 stays 11, but 0011 becomes 1100.
How do I reverse bits in code?
Loop once per bit: shift the result left, OR in the lowest bit of the input, then shift the input right. Faster versions swap neighboring bits, pairs and nibbles with masks, or use an instruction such as RBIT on ARM.
Why did the example give the same answer as a NOT operation?
The sample 01001101 happens to be a word whose mirror image equals its complement. That is a property of this particular pattern. Try 0011, which reverses to 1100 and also inverts to 1100, then 0001, which does not.