Redis › Strings & Bitmaps in Redis

How would you use bitmap operations like BITOP to combine multiple daily activity bitmaps and answer questions like how many users were active on both of two specific days?

Advanced

Answer

You use BITOP with the AND operation to combine two bitmaps into a new one where only bits set in both original bitmaps remain set, and then run BITCOUNT on that resulting combined bitmap to get the count of users active on both days, giving you powerful analytical capabilities using very simple, efficient bitwise operations.
BITOP AND result_key user_active:2026-09-06 user_active:2026-09-07
BITCOUNT result_key
Real-world example A product analytics team calculates how many users were active on both Saturday and Sunday by combining the two days' bitmaps with a bitwise AND operation, then counting the resulting set bits, all using extremely memory efficient bitmap operations.

Common follow-ups: What other bitwise operations besides AND does BITOP support?;How does this approach scale for calculating activity across many different days at once?