Hex Bit Clear Calculator
Clear a specific bit of a hex value to 0 by its index — every other bit stays exactly as it was, with the before/after binary shown side by side.

Built by
Swapnil SanghviFull-Stack Web Developer & WordPress Developer
Swapnil Sanghvi is a full-stack web and WordPress developer, UI designer, and full-time freelancer who builds and maintains Hex Calculator.
Further reading: Bitwise operation — Wikipedia
How to Clear a Specific Bit
Build a mask with only the target bit index set to 1, invert that mask (flip every bit), then AND it with your value. AND guarantees the target bit becomes 0 while every other bit — where the inverted mask has a 1 — passes through untouched.
Bit Clear Example, Step by Step
Clear bit 3 of 0xFF = 0xF7
0xFF with bit 3 cleared = 0xF7
1111 1111 (0xFF) 1111 0111 (~mask: every bit except bit 3) ----------- 1111 0111 (0xF7, AND)
| Step | Description | Result |
|---|---|---|
| Build the bit-3 mask | 1 shifted left by 3 = 0b1000 | 0x08 |
| Invert the mask | NOT 0x08 (8-bit) = 0xF7 | 0xF7 |
| AND with the value | 0xFF & 0xF7 | 0xF7 |
Every other bit stayed 1 since the inverted mask has a 1 everywhere except bit 3 — only the targeted bit changed.
Where Bit Clear Actually Comes Up
Disabling a Single Hardware Register Bit
Turning off one control bit in a microcontroller register — like disabling an interrupt or a peripheral — without disturbing any of the register's other configured bits.
register &= ~(1 << ENABLE_BIT)
Turning Off One Option Flag
Clearing a specific bit in a flags value to disable one feature while leaving every other flag exactly as it was.
flags & ~(1 << READ_ONLY_BIT)
Resetting a Status Bit After Handling an Event
Many hardware status registers require explicitly clearing a bit after handling the event it signaled, so the same interrupt or flag can trigger again later.
clear the pending-interrupt bit after servicing it
Why Use This Calculator Instead of Doing It by Hand
- Builds and inverts the bit mask and applies the AND for you
- Supports 8/16/32/64-bit widths
- Runs entirely in your browser — nothing you type gets sent anywhere
- Also available in Set and Toggle modes in the same calculator
Limitations
- Clears one bit at a time — to clear several specific bits at once, build a combined mask with the Hex Bit Mask Calculator and AND its inverse in yourself.
- Bit index must be within the selected bit width (0 to width-1).
Frequently Asked Questions
How do you clear one specific bit in a hex value?
AND the value with the inverse of a mask that has only that one bit set — every other bit passes through unchanged, and the target bit becomes 0 regardless of what it was before.
What if the bit is already 0?
Nothing changes — clearing a bit that's already 0 leaves it at 0, since AND with 0 always gives 0 regardless of the starting value.
How is Bit Clear different from Bit Toggle?
Clear always forces the target bit to 0, no matter its starting value. Toggle flips it — 1 becomes 0, but 0 becomes 1. Use Clear when you want a guaranteed 0 regardless of the current state.
What's the relationship between Bit Clear and Bit Mask?
Clearing bit n uses the inverse of the same single-bit mask that Bit Set uses to set bit n — the Hex Bit Mask Calculator can build a wider mask if you need to clear a whole range at once.