Bitwise Calculator
Calculate AND, OR and XOR for two whole numbers.
Result
How it is calculated
The tool converts both numbers to binary and combines them bit by bit. AND gives 1 only where both numbers have a 1, OR gives 1 where at least one has a 1, and XOR gives 1 where exactly one has a 1. The three results are shown as ordinary decimal numbers. Inputs must be whole numbers; a value with a fractional part returns no result. Enter plain decimal numbers (for example 255, not FF or 11111111). Negative integers are handled in 64-bit two's complement, the way programming languages do it, so keep values in the 64-bit range. This is different from arithmetic: 12 AND 10 is not a sum or a product of 12 and 10.
Worked example
Take a = 12 and b = 10. In binary, 12 is 1100 and 10 is 1010. AND: 1100 and 1010 share only the leftmost 1, giving 1000 = 8. OR: any 1 counts, giving 1110 = 14. XOR: positions where the bits differ, giving 0110 = 6.
Common mistakes
- Typing a binary or hexadecimal string such as 1100 or FF; the tool reads it as a decimal number.
- Confusing XOR with the power operator, since some languages write ^ for both ideas.
- Entering decimals like 2.5; only whole numbers are accepted.
- Expecting the result to be a sum, for instance thinking 12 OR 10 is 22.
- Mixing up AND with the logical && of programming languages, which tests true or false rather than individual bits.
About this calculator
This calculator computes the bitwise AND, OR and XOR of two integers by comparing them bit by bit in binary: AND returns a 1 only where both numbers have a 1 in that position, OR returns a 1 where either number does, and XOR (exclusive or) returns a 1 only where exactly one of the two does. These operations work on the raw binary representation of a number, not its decimal value, which is what makes them behave so differently from ordinary arithmetic.
Programmers use bitwise operations constantly for tasks like setting or checking individual flags packed into a single integer, working with permission bits, manipulating pixel colors in graphics code, and low-level performance tricks in embedded and systems programming. This calculator lets you verify the result of a bitwise expression by hand before or instead of running it in code.
Was this helpful?
You can pick up to 3 reactions.
Popular calculators
Loan Calculator
Monthly payment, total interest and full amortization schedule.
Percentage Calculator
Percent change, percent of, and ratio calculations.
Discount Calculator
Calculate final price, savings, and discount amount.
BMI Calculator
Body mass index from height and weight (metric or imperial).
Age Calculator
Compute your exact age in years, months and days from a birth date.
Compound Interest Calculator
Calculate the final amount and interest earned with compounding.
All Calculators
- Loan Calculator
- Profit Calculator
- Discount Calculator
- BMI Calculator
- Percentage Calculator
- Ideal Weight Calculator
- Age Calculator
- Pregnancy Due Date Calculator
- Compound Interest Calculator
- BMR Calculator (Basal Metabolic Rate)
- Tip Calculator
- Fuel Cost Calculator
- Date Difference Calculator
- Sleep Cycle Calculator
- Daily Water Intake Calculator
- Simple Interest Calculator
- Heart Rate Zones Calculator
- Running Pace Calculator
- Pet Age Calculator
- Calories Burned Calculator
- Macro Calculator
- TDEE Calculator (Total Daily Energy Expenditure)
- Waist-to-Hip Ratio Calculator
- Honor Roll Calculator
- One Rep Max (1RM) Calculator
- Ovulation Calculator
- Electricity Cost Calculator
- Unit Price Calculator
- Savings Goal Calculator
- Break-Even Point Calculator
- Paint Calculator
- Course Grade Average Calculator
- Business Days Calculator
- Time Duration Calculator
- Fuel Economy Calculator
- Temperature Converter
- Tile Calculator
- Aspect Ratio Calculator
- Roman Numeral Converter
- Goal Weight Timeline Calculator
- Salary Converter (Hourly to Annual)
- Credit Card Validator (Luhn)
- Body Surface Area (BSA) Calculator
- Feels-Like Temperature Calculator
- Ohm’s Law Calculator
- PPI (Pixel Density) Calculator
- Molar Mass Calculator
- Zodiac Sign Calculator (Western + Chinese)
- IBAN Validator
- Shoe Size Converter
- Country Info & Dialing Code Lookup
- Time Zone Difference (World Clock)
- CAGR (Compound Annual Growth Rate) Calculator
- Rule of 72 Calculator
- Blood Alcohol Content (BAC) Calculator
- Lean Body Mass (LBM) Calculator
- Pythagorean Theorem Calculator
- Speed Converter
- Download Time Calculator
- Date Calculator (Add/Subtract)
No calculators found
Comments (1)
AND is the usual way to test a flag. To see whether the bit worth 4 is set in a permission value of 13, enter 13 and 4: a result of 4 means it is set, 0 means it is not. XOR is reversible, since 12 XOR 10 gives 6 and 6 XOR 10 brings back 12. Results appear in decimal only, so keep your own note of the binary layout. Which operation, such as NOT or shifts, should we add next?