Skip to main content
math

Bitwise Calculator

Perform bitwise AND, OR, XOR, NOT, NAND, NOR, and XNOR operations on binary numbers. Shows truth tables and binary results.

Reviewed by Chase FloiedUpdated

This free online bitwise calculator provides instant results with no signup required. All calculations run directly in your browser — your data is never sent to a server. Enter your values below and see results update in real time as you type. Perfect for everyday calculations, homework, or professional use.

Not used for NOT

How to Use This Calculator

1

Enter your input values

Fill in all required input fields for the Bitwise Calculator. Most fields include unit selectors so you can work in your preferred unit system — metric or imperial, whichever matches your problem.

2

Review your inputs

Double-check that all values are correct and that you have selected the right units for each field. Incorrect units are the most common source of calculation errors and can produce results that are off by factors of 2, 10, or more.

3

Read the results

The Bitwise Calculator instantly computes the output and displays results with units clearly labeled. All calculations happen in your browser — no loading time and no data sent to a server.

4

Explore parameter sensitivity

Try adjusting individual input values to see how the output changes. This is a quick and effective way to develop intuition about how different parameters influence the result and to identify which inputs have the largest effect.

Formula Reference

Bitwise Calculator Formula

See calculator inputs for the governing equation

Variables: All variables and their units are labeled in the calculator interface above. Input fields accept values in multiple unit systems — select your preferred unit from the dropdown next to each field.

When to Use This Calculator

  • Use the Bitwise Calculator when you need a quick mathematical result without writing out all the steps manually, saving time on repetitive calculations.
  • Use it to verify hand calculations on tests or assignments and catch arithmetic mistakes.
  • Use it when teaching or explaining mathematical concepts to others, demonstrating how changing inputs affects the result.
  • Use it to explore the behavior of mathematical functions across a range of inputs.

About This Calculator

The Bitwise Calculator is a free mathematical calculation tool for students, educators, and professionals who need quick, reliable results. Perform bitwise AND, OR, XOR, NOT, NAND, NOR, and XNOR operations on binary numbers. Shows truth tables and binary results. The underlying algorithms implement well-established mathematical formulas and numerical methods. Results are computed instantly in the browser. This tool is useful for learning, verification of hand calculations, and rapid exploration of mathematical relationships. All computation happens locally — no data is sent to a server.

About Bitwise Calculator

Bitwise operations are logic operations applied to each pair of corresponding bits in two binary numbers. They are the fundamental building blocks of digital logic and are used extensively in low-level programming, cryptography, graphics, networking, and embedded systems. AND extracts specific bits (masking), OR sets bits, XOR toggles bits and detects differences, and NOT inverts all bits. Understanding bitwise operations is essential for working with flags, permissions, network masks, hash functions, and hardware registers. This calculator performs all seven standard bitwise operations and displays the inputs and result in both decimal and binary.

The Math Behind It

Bitwise operations apply Boolean logic independently to each bit position. AND (&): output bit is 1 only when both input bits are 1. Used for masking (extracting specific bits) and clearing bits. OR (|): output is 1 when at least one input is 1. Used for setting bits. XOR (^): output is 1 when inputs differ. Used for toggling bits, swapping without a temporary variable (a^=b; b^=a; a^=b), and detecting changes. NOT (~): inverts every bit. NAND, NOR, XNOR are the complements of AND, OR, XOR respectively. NAND and NOR are functionally complete — any logic function can be built from NAND gates alone (or NOR gates alone). De Morgan's laws connect these: ~(A & B) = ~A | ~B and ~(A | B) = ~A & ~B.

Formula Reference

AND

1 AND 1 = 1; all other combinations = 0

Variables: Bit is 1 only if both inputs are 1

OR

0 OR 0 = 0; all other combinations = 1

Variables: Bit is 1 if either input is 1

XOR

Same inputs = 0; different inputs = 1

Variables: Bit is 1 if inputs differ

NOT

NOT 0 = 1; NOT 1 = 0

Variables: Inverts each bit

Worked Examples

Example 1: 170 AND 204

Compute 10101010₂ AND 11001100₂.

Step 1:10101010 AND 11001100
Step 2:Bit by bit: 1&1=1, 0&1=0, 1&0=0, 0&0=0, 1&1=1, 0&1=0, 1&0=0, 0&0=0
Step 3:Result: 10001000₂

170 AND 204 = 136₁₀ = 10001000₂

Common Mistakes & Tips

  • !Confusing bitwise AND (&) with logical AND (&&) — bitwise operates on each bit; logical treats the entire value as true/false.
  • !Forgetting that NOT depends on bit width — ~0 is 0xFF in 8 bits but 0xFFFFFFFF in 32 bits.
  • !Not understanding operator precedence — in most languages, & has lower precedence than ==.

Related Concepts

Used in These Calculators

Calculators that build on or apply the concepts from this page:

Frequently Asked Questions

What is bit masking?

Bit masking uses AND with a mask to extract specific bits. For example, value & 0x0F extracts the lower 4 bits (lower nibble) of a byte.

How does XOR swap two values without a temp variable?

a ^= b; b ^= a; a ^= b. This works because XOR is its own inverse: (a ^ b) ^ b = a.