Hex Bitwise Calculator
Perform hexadecimal bitwise AND, OR, XOR, NOT, NAND, NOR and XNOR operations with exact 8, 16, 32 or 64-bit arithmetic. Enter hex values, inspect their binary representations and view the resulting hexadecimal, binary and unsigned decimal values.
—
—
—
—
Hex Bitwise Calculator
The Hex Bitwise Calculator performs common bitwise operations directly on hexadecimal integers. It supports AND, OR, XOR, NOT, NAND, NOR and XNOR and displays the exact binary, hexadecimal and unsigned decimal result.
Hexadecimal is especially convenient for bitwise work because every hexadecimal digit corresponds to four binary bits. For example, hexadecimal A is binary 1010 and hexadecimal F is binary 1111.
The calculator supports 8-bit, 16-bit, 32-bit and 64-bit widths using exact integer arithmetic, making it suitable for masks, registers, protocol values, firmware constants and larger unsigned values.
How to Use the Hex Bitwise Calculator
Enter hexadecimal Value A and Value B, choose a bitwise operation and select the required bit width. For the unary NOT operation, only Value A is required.
Press Calculate Hex Bitwise Result. The calculator converts both operands to fixed-width binary, applies the selected operation and converts the result back to hexadecimal and decimal.
A:
CC
B:
AA
Operation:
AND
Binary:
11001100
10101010
Result:
10001000
Hex:
88Hexadecimal AND Calculator
Bitwise AND produces a 1 only when both corresponding input bits are 1. It is commonly used to clear bits or extract selected fields with masks.
A:
CC = 11001100
B:
AA = 10101010
AND:
88 = 10001000Hexadecimal OR Calculator
Bitwise OR produces a 1 whenever either corresponding input bit is 1. It is often used to set selected bits.
A:
CC = 11001100
B:
AA = 10101010
OR:
EE = 11101110Hexadecimal XOR Calculator
XOR produces a 1 when corresponding bits differ and 0 when they are equal.
A:
CC = 11001100
B:
AA = 10101010
XOR:
66 = 01100110XOR is commonly used for toggling bits, comparing bit patterns and various low-level algorithms.
Hexadecimal NOT Calculator
Bitwise NOT inverts every bit in the selected width. Because NOT depends on width, hexadecimal CC has different NOT results at 8 and 16 bits.
8-bit:
A:
CC = 11001100
NOT:
33 = 00110011
16-bit:
A:
00CC
NOT:
FF33Hexadecimal NAND Calculator
NAND means NOT AND. The calculator first performs AND and then inverts the result inside the selected fixed-width mask.
A:
CC
B:
AA
AND:
88
NAND:
77Hexadecimal NOR Calculator
NOR is the inverse of OR. Every bit in the OR result is complemented within the chosen width.
A:
CC
B:
AA
OR:
EE
8-bit NOR:
11Hexadecimal XNOR Calculator
XNOR is the inverse of XOR and returns 1 where corresponding bits are equal.
A:
CC
B:
AA
XOR:
66
XNOR:
99Hex Bitwise Operation Comparison
| Operation | A = CC | B = AA | 8-Bit Result |
|---|---|---|---|
| AND | CC | AA | 88 |
| OR | CC | AA | EE |
| XOR | CC | AA | 66 |
| NAND | CC | AA | 77 |
| NOR | CC | AA | 11 |
| XNOR | CC | AA | 99 |
Why Hexadecimal Works Well for Bitwise Operations
Every hexadecimal digit represents exactly four binary bits, called a nibble. This makes conversions between hex and binary direct and predictable.
Hex:
D6
D:
1101
6:
0110
D6:
11010110This compact representation is why addresses, memory values, registers, masks and binary file data are frequently written in hexadecimal.
8-Bit Hex Bitwise Operations
An 8-bit hexadecimal value contains two hex digits and ranges from 00 through FF.
Maximum 8-bit value:
FF
Binary:
11111111
Decimal:
255All calculations in 8-bit mode are restricted to those eight binary positions.
16-Bit Hex Bitwise Operations
A 16-bit value contains four hexadecimal digits and ranges from 0000 to FFFF.
A:
1234
B:
00FF
AND:
0034
OR:
12FF
XOR:
12CB
NOT A:
EDCB32-Bit Hex Bitwise Operations
32-bit mode supports eight hexadecimal digits and the complete unsigned range from 00000000 through FFFFFFFF.
A:
FFFFFFFF
B:
0F0F0F0F
AND:
0F0F0F0F
XOR:
F0F0F0F0
XNOR:
0F0F0F0FThe tool does not rely on ordinary JavaScript signed 32-bit bitwise results, so values with the highest bit set remain unsigned.
64-Bit Hex Bitwise Operations
64-bit mode accepts up to sixteen hexadecimal digits and uses exact BigInt arithmetic.
A:
FFFFFFFFFFFFFFFF
B:
0000000000000001
AND:
0000000000000001
XOR:
FFFFFFFFFFFFFFFE
XNOR:
0000000000000001This avoids precision loss that can occur when 64-bit values are stored in ordinary floating-point numbers.
Why Bit Width Matters
AND, OR and XOR produce the same lower-bit relationships regardless of additional leading zero positions, but operations containing NOT depend directly on width.
A:
01
8-bit NOT:
FE
16-bit NOT:
FFFE
32-bit NOT:
FFFFFFFEThe width defines which bits are considered part of the integer and therefore which bits the NOT operation should invert.
Hex Masks and Bitwise AND
AND is frequently used with hexadecimal masks to isolate selected bits or fields.
Value:
D7
Mask:
0F
AND:
07
Binary:
11010111
00001111
--------
00000111The mask clears the upper four bits while preserving the lower four.
Set Bits with Hex OR
OR can force particular bits to one while leaving other positions unchanged.
Value:
80
Mask:
0F
OR:
8FThe lower nibble becomes all ones while the existing high bit remains set.
Toggle Bits with Hex XOR
XOR is useful for toggling selected bits. A mask bit of 1 flips the corresponding value bit, while a mask bit of 0 leaves it unchanged.
Value:
AA
Mask:
0F
XOR:
A5Hex Bitwise Calculator for Registers
Hardware registers are frequently documented using hexadecimal values because individual bit fields can be seen more compactly than in long binary strings.
A developer may AND a register with a mask to extract flags, OR it with a mask to set control bits, XOR selected positions to toggle them or use NOT-based operations while testing logic expressions.
Register:
B6
Mask:
0F
B6 AND 0F:
06
B6 OR 0F:
BF
B6 XOR 0F:
B9Hex Bitwise Calculator for Programming
Bitwise operations appear throughout low-level software, operating systems, graphics, embedded programming, networking, cryptography, compression and binary file formats.
Hexadecimal is often preferred when code contains constants such as 0xFF, 0x8000 or 0xFFFFFFFF because these values correspond neatly to groups of binary bits.
Typical use cases
Common uses include permission masks, status flags, device registers, protocol fields, color channels, packet parsing, feature flags, instruction encoding and binary data inspection.
Hex Bitwise vs Decimal Bitwise Calculation
The underlying operation is identical regardless of whether a number is written in hexadecimal, decimal or binary. Only the textual representation differs.
Hex:
CC AND AA = 88
Decimal:
204 AND 170 = 136
Binary:
11001100 AND 10101010 = 10001000
All three represent the same calculation.Common Hex Bitwise Calculation Mistakes
One common mistake is forgetting that hexadecimal digits represent groups of four bits rather than decimal digits. Hexadecimal 10 equals decimal 16, not decimal 10.
Another mistake is applying unrestricted NOT without choosing a width. A fixed-width mask must be used to obtain a useful unsigned NOT, NAND, NOR or XNOR result.
It is also important to avoid confusing bitwise operators with logical operators. A bitwise operation produces a result for every binary position rather than reducing the entire value to true or false.
Hex Bitwise Calculator Limitations and Notes
This calculator handles unsigned 8, 16, 32 and 64-bit hexadecimal integers. Negative signed values are intentionally excluded because their hex representation depends on a signed encoding and fixed width.
Values shorter than the selected width are treated as having leading zeros. For example, CC in 16-bit mode is treated as 00CC.
NOT-based operations are explicitly masked to the selected width, ensuring predictable unsigned results instead of sign-extended values.