Bitwise Calculator
Calculate bitwise AND, OR, XOR, and NOT on decimal or binary numbers. Pick bit size, enter values, and copy the result instantly. Copy in one click.
Bitwise Calculator
Result will appear here...
What the bitwise calculator does
This runs the bitwise operations on numbers: AND, OR, XOR, NOT, and the left and right shifts. Choose your operation, enter the numbers, and it shows the result in decimal, binary, octal, and hexadecimal all at once.
Bitwise operations are different from ordinary arithmetic. Instead of treating a number as a single value, they reach inside it and work on its individual bits, which is exactly what you need when a number is really being used as a row of on-and-off switches.
How to use it
- Choose a bit size and data type. The bit size sets how wide the numbers are; the data type lets you enter them in decimal, binary, hex, or octal.
- Enter the numbers. Most operations use two numbers. NOT works on the first one alone.
- Pick an operation and press Calculate. The result appears in all four bases together.
Press Reset to clear the inputs.
Working one bit at a time
The idea behind every bitwise operation is the same: line the two numbers up by their bits and handle each column on its own. The rightmost bit of one number meets the rightmost bit of the other, the next bits meet, and so on up. There is no carrying between columns the way there is in addition, because each bit position is decided entirely by itself. That independence is what makes these operations quick and predictable.
AND, OR, and NOT
Three of the operations are the classic logic gates, and each has a one-line rule:
- AND gives 1 only when both bits are 1. So 1100 AND 1010 is 1000, since the leftmost column is the only one where both numbers hold a 1.
- OR gives 1 when either bit is 1. So 1100 OR 1010 is 1110, because every column except the last has a 1 somewhere.
- NOT flips every bit of a single number. In four bits, NOT 1100 is 0011, each 1 becoming 0 and each 0 becoming 1.
Read those as little tests: AND asks are both on, OR asks is either on, and NOT simply reverses the answer in every position.
The real use: masking bits
The reason these operations matter so much is masking, which means using one number, the mask, to reach in and act on chosen bits of another. AND and OR are the tools for the job. To turn certain bits on, you OR with a mask that has 1s in those spots. To check or keep only certain bits, you AND with a mask that has 1s where you care and 0s everywhere else, which clears the rest to 0.
This is how a single number can store a set of yes-or-no settings at once. Think of file permissions or option flags: read, write, and execute can each be one bit. You combine them by ORing them together, and you test for one by ANDing with its mask and seeing whether anything survives. One small number, several independent switches, all handled with AND and OR.
XOR and the shifts
This calculator also handles XOR, which sets a bit where the two numbers differ, and the left and right shifts, which slide a number's bits sideways. They each have plenty of their own uses, so they have dedicated calculators that go into them in depth, the XOR calculator and the bit shift calculator. Here they sit alongside AND, OR, and NOT so you can reach any of them from one place.
Questions people ask
Which operations does it cover?
AND, OR, XOR, NOT, and the left and right shifts. You choose one from the operation list, and most use two numbers while NOT uses one.
What is the difference between AND and OR?
AND gives 1 only when both bits are 1, so it is good for keeping or testing bits. OR gives 1 when either bit is 1, so it is good for turning bits on.
What is masking?
Masking is using one number to act on chosen bits of another. AND with a mask keeps or clears bits, and OR with a mask sets them, which lets a single number hold several on-or-off settings.
Why show the result in four bases?
Because bit work often crosses between binary, hex, octal, and decimal. Showing all four lets you read the answer in whichever form your task uses without converting it yourself.
References
- Bitwise operation. Wikipedia, The Free Encyclopedia. https://en.wikipedia.org/wiki/Bitwise_operation
Ankit Khatiwada is a researcher and graduate student in Computer Science at Saarland University, with strengths in statistics, data analysis, data engineering, and full stack development. His work sits at the intersection of quantitative reasoning and applied technology, making him a strong fit for tools that depend on clear numerical logic. At Eon Tools, he reviews number and statistical tools.