Skip to main content
math

AND Calculator

Perform the bitwise AND operation on two numbers. Each output bit is 1 only when both corresponding input bits are 1.

By Christopher FloiedPublished Updated

Results

A AND B (Decimal)

12

A (Binary)

111100

B (Binary)

1101

Result (Binary)

1100

How to Use This Calculator

1

Enter your input values

Fill in all required input fields for the AND Calculator. Follow the units and input format printed next to each field. Where a unit selector is available, choose the units that match your data.

2

Review your inputs

Double-check that all values are correct and match the units or format shown 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 AND Calculator computes the output in your browser and displays the results, with units clearly labeled, as soon as they are ready — 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.

When to Use This Calculator

  • •Use the AND 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.

Related Calculators

About AND Calculator

The AND operation is the most fundamental bitwise operation. It compares each pair of corresponding bits in two numbers and produces a 1 only when both bits are 1; otherwise it produces 0. AND is used for bit masking — extracting specific bits from a number by ANDing with a mask that has 1s in the positions you want to keep and 0s elsewhere. It is also used for clearing bits (AND with 0 clears), checking if a bit is set (AND with a power of 2), and implementing subnet masks in networking. AND gates are one of the basic building blocks of digital circuits.

The Math Behind It

The AND operation satisfies: A & 0 = 0 (annihilation), A & A = A (idempotent), A & ~A = 0, A & (all 1s) = A (identity), A & B = B & A (commutative), (A & B) & C = A & (B & C) (associative). De Morgan's law: ~(A & B) = ~A | ~B. AND is used in: bit masking (value & mask), testing bit k (value & (1 << k)), clearing bit k (value & ~(1 << k)), computing modulo powers of 2 (n & (m-1) = n mod m when m is a power of 2). In networking, IP & SubnetMask = NetworkAddress.

Formula Reference

AND Truth Table

0&0=0, 0&1=0, 1&0=0, 1&1=1

Variables: Output is 1 only when both inputs are 1

Worked Examples

Example 1: 60 AND 13

Compute bitwise AND of 60 and 13.

Step 1:60 = 111100₂
Step 2:13 = 001101₂
Step 3:AND: 001100₂

60 AND 13 = 12₁₀ = 001100₂

Common Mistakes & Tips

  • !Confusing & (bitwise AND) with && (logical AND) in programming.
  • !Expecting AND to add or combine values — it only keeps bits where both inputs have 1.

Related Concepts

Used in These Calculators

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

Frequently Asked Questions

How do I check if a specific bit is set?

AND the number with 2^k (or 1 << k) where k is the bit position. If the result is non-zero, bit k is set.

Add the live AND Calculator to your site. Free to embed, with a link back to MegaCalc.