Skip to content
Hex Calculator

Hex Bitwise Calculator

Run AND, OR, XOR, and NOT on hex values with a bit-width selector and aligned binary output showing exactly how each bit combines.

Bit width
Hexadecimal
0x00
Decimal
0

Binary, aligned by bit

A: 11110000
B: 00001111
=: 00000000
Swapnil Sanghvi

Built by

Swapnil Sanghvi

Full-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.

Hex Bitwise Calculator tool preview card from Hex Calculator
Share preview: this is the card that appears when you share the Hex Bitwise Calculator page on social media.

Further reading: Bitwise operation — Wikipedia

How Bitwise Operations Work

Each bitwise operation compares two values one bit at a time (or, for NOT, inverts one value one bit at a time). AND keeps a result bit only when both inputs have that bit set; OR sets a result bit when either input does; XOR sets a result bit only when the inputs disagree; NOT simply flips every bit.

Hex AND Example, Step by Step

F0 AND 0F = 00

0xF0 & 0x0F = 0x00

  1111 0000
& 0000 1111
-----------
  0000 0000
StepDescriptionResult
Align bitsF0 = 11110000, 0F = 000011118 bits each
AND each bit paira result bit is 1 only where both inputs are 1no overlapping 1 bits
Resultno bit position has 1 in both operands0x00

F0 and 0F don't share any 1 bits, so ANDing them clears everything — this is exactly why AND is used to mask out (clear) bits you don't want.

Bitwise Operation Reference

OperationF0 . 0FResult rule
AND (&)0x001 only where both bits are 1
OR (|)0xFF1 where either bit is 1
XOR (^)0xFF1 where the bits differ
NOT (~F0)0x0Fevery bit flipped (8-bit width)

Where Bitwise Operations Actually Come Up

Masking Out Unwanted Bits

ANDing a value with a mask clears every bit outside the mask, which is how low-level code isolates a specific field — like the low byte — out of a larger register.

value & 0xFF isolates the low byte

Combining Flag Bits

ORing individual flag values together sets multiple option bits at once without disturbing bits already set — the standard way permission and configuration flags get combined.

READ | WRITE combines two flags

Toggling Specific Bits

XORing a value against a mask flips exactly the bits in that mask and leaves everything else untouched — useful for toggling a status bit without needing to know its current state.

state ^ 0x01 flips the low bit

Why Use This Calculator Instead of Doing It by Hand

  • Shows aligned binary for both operands and the result, not just the final hex
  • Supports 8/16/32/64-bit widths, since NOT and OR results depend on width
  • Runs entirely in your browser — nothing you type gets sent anywhere
  • Covers all four core operations in one calculator instead of four separate tools

Limitations

  • Results are bit-width dependent — the same NOT of 0x0F is 0xF0 at 8-bit but 0xFFF0 at 16-bit, so make sure the selected width matches your actual data type.
  • Combines two values at a time (or one for NOT) — chain results manually for three or more.

Frequently Asked Questions

What operations does this bitwise calculator support?

AND, OR, XOR, and NOT — the four bitwise operations that cover the vast majority of masking, flag, and toggle logic in real code.

Why does bit width matter for bitwise operations?

A bitwise NOT on 0x0F at 8-bit width gives 0xF0, but the same NOT at 16-bit width gives 0xFFF0 — the result depends entirely on how many bits are involved, so always match the width to your actual data type.

What's the practical difference between AND, OR, and XOR?

AND clears bits (use it to mask), OR sets bits (use it to combine flags), and XOR toggles bits (use it to flip specific bits or compute a simple difference) — the operation to reach for depends on whether you're clearing, setting, or flipping.

Can I chain more than two values together?

This calculator combines two values (or one, for NOT) at a time — for three or more, apply the operation to the first two, then combine that result with the next value.

Does this show the binary bit-by-bit, not just the final hex result?

Yes — both operands and the result are shown in aligned binary underneath the hex output, so you can see exactly which bits combined to produce each result bit.

What is bitwise NOT actually used for?

Inverting a mask — if 0x0F selects the low nibble, NOT 0x0F gives you a mask that selects everything except the low nibble, at whatever bit width you're working in.