Create and apply bit masks with visual toggles
Green = bit survives (1 in both value and mask) · Yellow = cleared by mask / no match
A bit mask is a pattern of bits used with bitwise operators to isolate, set, or clear specific bits in a value. Each bit you select in the mask determines whether that position is affected when you apply it to your data.
Use AND masking to extract specific bits from a value. Bits in the result are 1 only where both the original value and the mask have 1s. It's how you read individual flags from a packed integer.
OR masking sets bits to 1 wherever the mask has a 1. Use it to enable specific flags in a value without modifying other bits — the classic pattern for setting configuration bits.
XOR toggles (flips) bits wherever the mask has a 1. Applying the same mask twice returns you to the original value, making XOR useful for simple encryption and hardware toggling.
I built this bit mask calculator because I was tired of mentally juggling hex values when working with hardware registers and permission flags. Click the bit toggles above to build your mask visually, enter a decimal value, and watch all three operations update in real time.
In embedded programming, a bit mask isolates individual bits from an ADC reading to extract sensor data. In C and Rust, file permission masks (like chmod) use bitwise OR to combine read, write, and execute flags. Graphics programmers use AND masks to extract color channel components from a packed pixel.
A bit mask is a pattern of bits used to select, clear, or toggle specific bits in a binary value. By applying a mask with bitwise AND, OR, or XOR operations, you can extract or modify individual bits without affecting the rest of the value. This bit mask calculator lets you build masks visually and see the results instantly.
To create a bit mask, decide which bit positions you want to include and set those bits to 1. For example, a mask for bits 0-3 (the lowest four bits) is 0000 1111 binary (0x0F hex, 15 decimal). You can use a bit mask calculator to visually toggle bits and see the resulting mask value in decimal, binary, and hex formats instantly.
AND masking (value & mask) clears all bits that are 0 in the mask — only bits that are 1 in both the value and the mask survive. OR masking (value | mask) sets all bits that are 1 in the mask to 1 in the result. XOR masking (value ^ mask) toggles all bits that are 1 in the mask. Use this bit mask calculator to experiment with all three operations simultaneously.
Bit masks allow you to pack multiple flags into a single integer, extract specific fields from hardware registers, apply permissions masks in file systems, and optimize storage by representing boolean states as individual bits rather than separate variables. Embedded developers, game programmers, and systems engineers use bit masks daily.
AND, OR, XOR, NOT — online bitwise operations
64-bit base conversion with BigInt precision
Compute SHA-256 checksums in your browser
Multi-base number converter for developers
Complete reference for bitwise operators