Meaning – The term mask, refers to a pattern of characters used to control retention or elimination of portions of another pattern of characters.

In computer science, a mask or bitmask is data that is used for bitwise operations, particularly in a bit field. Using a mask, multiple bits in a byte, nibble, word etc. can be set either on, off, or inverted from on to off (or vice versa) in a single bitwise operation.

In binary operations, a bitmask can filter bit values using logical operations. For instance, a bitmask of 00001111 one operand of the boolean AND operation, converts the first four bits of the other operand to 0. The final four bits will be unchanged. This operation is called “masking out” the first four bits, changing them to 0.

Example of usage“If the OR operator is used, any 1 values in the bitmask produce a 1 in the corresponding result, and other bits remain unchanged. So, a bitmask of 00001111, used with OR, will “mask out” the last four bits, changing them to 1.”