Advertisement
Intermediate Redis, Strings & Bitmaps in Redis

What are Redis bitmaps, and how do they let you efficiently work with individual bits within a string?

Short answer

A Redis bitmap is not actually a separate data type but rather a way of treating a regular string as a sequence of individual bits, letting you use commands like SETBIT and GETBIT to set or read a specific bit's value, which is extremely memory efficient for tracking simple…

Save Redis mock interview
Advertisement
AModel answer
A Redis bitmap is not actually a separate data type but rather a way of treating a regular string as a sequence of individual bits, letting you use commands like SETBIT and GETBIT to set or read a specific bit's value, which is extremely memory efficient for tracking simple binary states, such as whether a specific user was active on a specific day.
Example

SETBIT user_active:2026-09-07 1001 1 GETBIT user_active:2026-09-07 1001

Real-world example
A user activity tracking system sets a single bit for each user who was active on a specific day, using an extremely compact bitmap representation instead of a much larger data structure to track the same information.
Likely follow-ups
  • How much memory does tracking a million users' daily activity actually require using a bitmap?
  • What does the specific bit position typically represent in a use case like this?
Related topics