Skip to main content

AND Calculator

Our free binary calculator solves andcalculator problems. Get worked examples, visual aids, and downloadable results.

Skip to calculator
Mathematics

And Calculator

Calculate the bitwise AND of two binary or decimal numbers. See bit-by-bit comparison, results in binary, decimal, hexadecimal, and octal formats.

Last updated: December 2025Reviewed by NovaCalculator Mathematics Team

Calculator

Adjust values & calculate
AND Result
00010010
Decimal: 18 | Hex: 0x12
Value A (Decimal)
22
00010110
Value B (Decimal)
26
00011010

Other Bitwise Operations

OR Result00011110 (30)
XOR Result00001100 (12)

Bit-by-Bit Comparison

Bit 70 AND 0 = 0
Bit 60 AND 0 = 0
Bit 50 AND 0 = 0
Bit 41 AND 1 = 1
Bit 30 AND 1 = 0
Bit 21 AND 0 = 0
Bit 11 AND 1 = 1
Bit 00 AND 0 = 0
1-bits in A
3
1-bits in B
3
1-bits in Result
2
Your Result
00010110 AND 00011010 = 00010010 (Decimal: 18, Hex: 0x12)
Share Your Result
Understand the Math

Formula

A AND B: Output bit = 1 only when both input bits = 1

The AND operation compares each bit of two numbers. For each bit position, the result is 1 if and only if both corresponding bits in the inputs are 1. Otherwise the result is 0. This is the most fundamental logical operation in digital computing.

Last reviewed: December 2025

Worked Examples

Example 1: Basic AND Operation with 8-bit Numbers

Calculate the AND of binary 10110110 (182) and 11010100 (212).
Solution:
Align both numbers and apply AND bit by bit: 10110110 (182) & 11010100 (212) ---------- 10010100 (148) Bit 7: 1 AND 1 = 1 Bit 6: 0 AND 1 = 0 Bit 5: 1 AND 0 = 0 Bit 4: 1 AND 1 = 1 Bit 3: 0 AND 0 = 0 Bit 2: 1 AND 1 = 1 Bit 1: 1 AND 0 = 0 Bit 0: 0 AND 0 = 0
Result: 10110110 AND 11010100 = 10010100 (decimal 148, hex 0x94)

Example 2: Subnet Mask AND Operation

Find the network address by ANDing IP 192.168.5.130 with subnet mask 255.255.255.192.
Solution:
Convert last octet to binary: 130 = 10000010 192 = 11000000 AND operation on last octet: 10000010 (130) & 11000000 (192) ---------- 10000000 (128) First three octets: 192 AND 255 = 192, 168 AND 255 = 168, 5 AND 255 = 5
Result: Network address: 192.168.5.128 (the host is on the .128 subnet)
Expert Insights

Background & Theory

The And Calculator applies the following established principles and formulas. Mathematics rests on a hierarchy of number systems, each extending the previous. The natural numbers (1, 2, 3, ...) support counting and ordering. The integers add negative values and zero, enabling subtraction without restriction. The rational numbers, expressible as p/q where p and q are integers and q is nonzero, close the system under division. The real numbers fill the gaps left by irrationals such as the square root of 2 or pi, forming a complete ordered field. The complex numbers, written as a + bi where i is the square root of negative one, complete the algebraic closure of the reals and allow every polynomial to have a root. Prime factorization states that every integer greater than one is uniquely expressible as a product of primes, a result known as the Fundamental Theorem of Arithmetic. Computing the greatest common divisor (GCD) of two integers relies most efficiently on the Euclidean algorithm: repeatedly replace the larger number with the remainder when it is divided by the smaller, until the remainder is zero. The last nonzero remainder is the GCD. The least common multiple (LCM) follows from the identity LCM(a, b) = |a * b| / GCD(a, b). Modular arithmetic defines equivalence classes of integers that share the same remainder under division by a modulus n. Fermat's Little Theorem and Euler's Theorem arise from this structure and underpin modern cryptography. Logarithms are the inverses of exponential functions. If b raised to the power x equals y, then the logarithm base b of y equals x. The natural logarithm uses base e, approximately 2.71828. Combinatorics counts arrangements and selections. The number of ordered arrangements (permutations) of r objects from n distinct objects is nPr = n! / (n - r)!. The number of unordered selections (combinations) is nCr = n! / (r! * (n - r)!). Pascal's triangle arranges these binomial coefficients so that each entry equals the sum of the two entries directly above it. The Fibonacci sequence, defined by F(1) = 1, F(2) = 1, and F(n) = F(n-1) + F(n-2), appears throughout nature and connects deeply to the golden ratio via Binet's formula.

History

The history behind the And Calculator traces back through the following developments. Mathematics as a systematic discipline traces to ancient Mesopotamia. Babylonian clay tablets dating to around 1800 BCE demonstrate knowledge of quadratic equations, Pythagorean triples, and base-60 arithmetic, suggesting a practical mathematical tradition far preceding Greek formalism. Euclid of Alexandria compiled the Elements around 300 BCE, establishing the axiomatic method that would define rigorous mathematics for over two thousand years. His work organized plane geometry, number theory, and proportion into logically chained propositions derived from a small set of postulates. The algorithm bearing his name for computing GCDs appears in Book VII and remains in use today. In the 9th century, the Persian scholar Muhammad ibn Musa Al-Khwarizmi wrote Al-Kitab al-mukhtasar fi hisab al-jabr wal-muqabala, the treatise whose title gave algebra its name. He systematized the solution of linear and quadratic equations and described procedures that operated on unknowns as objects, a conceptual leap away from purely numerical calculation. Rene Descartes introduced coordinate geometry in 1637 by uniting algebra and Euclidean geometry, allowing curves to be studied through equations. This synthesis set the stage for calculus. Isaac Newton and Gottfried Wilhelm Leibniz independently developed calculus during the 1660s and 1670s, triggering a priority dispute that lasted decades and divided British and Continental mathematicians. Carl Friedrich Gauss proved the Fundamental Theorem of Algebra in 1799, showing that every nonconstant polynomial has at least one complex root. His Disquisitiones Arithmeticae of 1801 established modern number theory. David Hilbert's formalist program at the turn of the 20th century sought to place all of mathematics on an explicit axiomatic foundation, a project that Kurt Godel's incompleteness theorems of 1931 showed to be fundamentally limited. Alan Turing's work in the 1930s on computability introduced the theoretical model of the stored-program computer and linked mathematical logic directly to the limits of algorithmic calculation. His proof that no algorithm can decide in general whether an arbitrary program will halt or run forever placed fundamental boundaries on what mathematics can mechanically determine, and it opened the discipline now known as theoretical computer science.

Share this calculator

Explore More

Frequently Asked Questions

The AND operation is a fundamental bitwise logical operation that compares two binary numbers bit by bit and produces a result where each output bit is 1 only if both corresponding input bits are 1. If either input bit is 0, the result bit is 0. This operation is one of the most basic building blocks of digital circuits and computer processors. Every modern CPU uses millions of AND gates to perform calculations, route signals, and make decisions. The AND operation follows a simple truth table: 0 AND 0 equals 0, 0 AND 1 equals 0, 1 AND 0 equals 0, and 1 AND 1 equals 1.
In programming, the AND operation serves many critical purposes. It is commonly used for bit masking, where you isolate specific bits from a number by ANDing it with a mask value. For example, to check if the lowest bit of a number is set (determining if the number is odd), you AND it with 1. Programmers also use AND for clearing specific bits, checking flags in bitmapped fields, and implementing permissions systems. In languages like C, Java, and Python, the bitwise AND operator is represented by the ampersand symbol. Network engineers use AND operations extensively to calculate subnet addresses from IP addresses and subnet masks.
AND, OR, and XOR are the three primary bitwise logical operations, each with distinct behavior. AND returns 1 only when both input bits are 1, making it the most restrictive operation. OR returns 1 when at least one input bit is 1, making it the most permissive of the three. XOR (exclusive OR) returns 1 only when the input bits differ, meaning one is 1 and the other is 0. These operations form the foundation of all digital logic. In practical terms, AND is used for masking and filtering, OR is used for combining flags and setting bits, and XOR is used for toggling bits and simple encryption schemes.
Bit masking with AND is a technique for extracting or isolating specific bits from a binary number. You create a mask where the bits you want to keep are set to 1 and the bits you want to discard are set to 0. When you AND the original number with this mask, only the bits at positions where the mask has a 1 will pass through, while all other bits become 0. For example, to extract the lower 4 bits of the number 11010110, you AND it with the mask 00001111, which gives 00000110. This technique is essential in embedded systems, network programming, graphics processing, and any field where individual bits carry specific meanings.
An AND gate is a physical electronic component that implements the AND logical operation in hardware. It has two or more input terminals and one output terminal. The output is high (logic 1) only when all inputs are simultaneously high. AND gates are built using transistors, and in modern CMOS technology, they combine NMOS and PMOS transistors to achieve this logic function. They are fundamental building blocks in processors, memory chips, and all digital electronics. Complex operations like addition, multiplication, and comparison are all built by combining AND gates with other gate types. A typical modern CPU contains billions of logic gates including AND gates.
Subnet masking is one of the most practical applications of the AND operation. When a network device needs to determine which subnet an IP address belongs to, it performs a bitwise AND between the IP address and the subnet mask. For example, the IP address 192.168.1.100 in binary is 11000000.10101000.00000001.01100100. ANDing this with a subnet mask of 255.255.255.0 (11111111.11111111.11111111.00000000) yields 192.168.1.0, which is the network address. This operation allows routers to quickly route packets to the correct network segment without complex string parsing or decimal arithmetic.
Educational Note: This calculator is provided for educational and informational purposes. Results are based on the formulas and inputs provided. Always verify important calculations independently. NovaCalculator processes calculator inputs client-side; optional analytics follow visitor consent settings.Reviewed by: NovaCalculator Mathematics TeamVerified against standard mathematical and scientific references. Last reviewed: December 2025. © 2024–2026 NovaCalculator.

Share this calculator

Formula

A AND B: Output bit = 1 only when both input bits = 1

The AND operation compares each bit of two numbers. For each bit position, the result is 1 if and only if both corresponding bits in the inputs are 1. Otherwise the result is 0. This is the most fundamental logical operation in digital computing.

Worked Examples

Example 1: Basic AND Operation with 8-bit Numbers

Problem: Calculate the AND of binary 10110110 (182) and 11010100 (212).

Solution: Align both numbers and apply AND bit by bit:\n 10110110 (182)\n& 11010100 (212)\n----------\n 10010100 (148)\n\nBit 7: 1 AND 1 = 1\nBit 6: 0 AND 1 = 0\nBit 5: 1 AND 0 = 0\nBit 4: 1 AND 1 = 1\nBit 3: 0 AND 0 = 0\nBit 2: 1 AND 1 = 1\nBit 1: 1 AND 0 = 0\nBit 0: 0 AND 0 = 0

Result: 10110110 AND 11010100 = 10010100 (decimal 148, hex 0x94)

Example 2: Subnet Mask AND Operation

Problem: Find the network address by ANDing IP 192.168.5.130 with subnet mask 255.255.255.192.

Solution: Convert last octet to binary:\n130 = 10000010\n192 = 11000000\n\nAND operation on last octet:\n 10000010 (130)\n& 11000000 (192)\n----------\n 10000000 (128)\n\nFirst three octets: 192 AND 255 = 192, 168 AND 255 = 168, 5 AND 255 = 5

Result: Network address: 192.168.5.128 (the host is on the .128 subnet)

Frequently Asked Questions

How accurate are the results from AND Calculator?

All calculations use established mathematical formulas and are performed with high-precision arithmetic. Results are accurate to the precision shown. For critical decisions in finance, medicine, or engineering, always verify results with a qualified professional.

Is my data stored or sent to a server?

No. All calculations run entirely in your browser using JavaScript. No data you enter is ever transmitted to any server or stored anywhere. Your inputs remain completely private.

Can I use AND Calculator on a mobile device?

Yes. All calculators on NovaCalculator are fully responsive and work on smartphones, tablets, and desktops. The layout adapts automatically to your screen size.

Why might my result differ from another tool or reference?

Differences typically arise from rounding conventions, the specific version of a formula (for example, simple vs compound interest), or unit inconsistencies between inputs. Check that both tools are using the same formula variant and the same units. The References section links to the authoritative source behind the formula used here.

How do I get the most accurate result?

Enter values as precisely as possible using the correct units for each field. Check that you have selected the right unit (e.g. kilograms vs pounds, meters vs feet) before calculating. Rounding inputs early can reduce output precision.

How do I interpret the result?

Results are displayed with a label and unit to help you understand the output. Many calculators include a short explanation or classification below the result (for example, a BMI category or risk level). Refer to the worked examples section on this page for real-world context.

References

Reviewed by Manoj Kumar, Mathematics Educator · Editorial policy