Skip to content
NSNormandin SystemsTHE EVERYDAY TOOLBOXMain site
±

Math / YOUR EVERYDAY TOOLBOX

Binary Calculator

Calculate bitwise/binary operations (AND, OR, XOR, NOT, shifts) between two numbers

✓ Free to use✓ No account neededHow to use this tool ↓
YOUR WORKSPACESee an example ↗

Opening your tool…

Runs in your browser. Check important results and keep a copy of your original files.

THE PRACTICAL GUIDE · NORMANDIN SYSTEMS

Get more from Binary Calculator

Binary Calculator applies AND, OR, XOR, NOT, and shift operations to integer bit patterns. It displays signed and unsigned results so you can relate an ordinary decimal number to its 32-bit representation. For example, decimal 5 AND decimal 3 produces 1 because only their lowest bit is set in both operands. Select the numeral base deliberately before entering digit strings. A current implementation limitation makes operand B follow operand A’s selected base, so use a common base for both operands rather than relying on mixed-base input. The tool is useful for inspecting masks and learning bitwise behavior, with care around negative numbers, shifts, and values beyond the 32-bit model.

Guide updated October 13, 2026

How to use this tool

  1. Select the numeral base for the operands and enter integer values. For a reliable baseline in this build, use the same base for both inputs.
  2. Enter A = 5 and B = 3 in decimal, then choose AND. Review the result 1 and the corresponding bit pattern.
  3. Try OR or XOR with the same inputs to compare bit-by-bit behavior. NOT uses A alone, while shifts use B as the shift count.
  4. Review signed and unsigned representations where relevant. Keep operands within the intended 32-bit model and validate edge cases before using results in another language or protocol.

SEE IT IN PRACTICE

A worked example

EXAMPLE INPUT
A = 5 (0101); B = 3 (0011); operation AND
RESULT / WHAT TO EXPECT
1 (0001)

AND retains a one only where both operands contain one at the same bit position. Only the last position matches in this example.

Read bit positions before decimal totals

For A = 5, binary 0101, and B = 3, binary 0011, AND produces 0001, OR produces 0111, and XOR produces 0110. Each operator applies its rule independently at each position. These operations are not ordinary arithmetic addition or Boolean evaluation of the entire number. Check the input-base selection first: the characters 10 represent different values in binary, decimal, and hexadecimal.

Understand the implementation’s width

The tool uses JavaScript number parsing followed by bitwise operators, whose ordinary number operands are handled as signed 32-bit values. Values outside that useful representation need special care, and a right shift can propagate the sign bit. Do not treat this calculator as arbitrary-precision binary arithmetic. Verify boundary cases if you are matching a protocol field or another language with a different integer width.

The current implementation also parses operand B using operand A’s base selection. Keep both base selectors the same for reliable examples, or convert both values into a common representation before entering them. A separate B selector does not currently guarantee independent interpretation.

Signed bit patterns

Bitwise operators describe positions within a machine representation. NOT can produce a negative decimal result because of a signed interpretation, and a right shift can preserve the sign bit. Check a small positive example first, then a negative or high-bit example if your use case depends on it. A displayed decimal number alone does not explain the full bit pattern.

When this tool is useful

  • Inspect bit masks using explicitly stated inputs.
  • Compare binary flag combinations by comparing the same calculation under different assumptions.
  • Work through a bitwise expression with a worked example that can be checked independently.

Tips for a better result

  • Use the same numeral base for both operands in this build: the current B parser follows A’s selected base even though a separate B base control is displayed. Mixed-base inputs should be converted to a common base first.
  • Use integer operands and preserve leading bits when reasoning about a fixed-width field; decimal rounding is not an appropriate step in a bitmask calculation.
  • A signed decimal result and an unsigned decimal result can represent the same 32-bit pattern. Inspect the bit display before deciding they describe different bits.

Frequently asked questions

Why can NOT produce a negative decimal result?

Bitwise operations use a signed machine representation in this implementation. Inverting bits changes the sign bit as well as the others; the decimal display reflects that signed interpretation.

Can I use different bases for A and B in this build?

Use the same base for both. The current parser reads B with A’s selected base even though B has a separate visible selector. Convert mixed-base values to one common base first.

Is this arbitrary-precision integer arithmetic?

No. The bitwise operations use JavaScript’s signed 32-bit number behavior. Values and shifts need to be interpreted within that model rather than as unlimited-width binary integers.

What happens to the information I enter?

The utility processes your input in this browser. Some tools retain field values in browser storage or the URL; avoid entering secrets in shareable fields. Page and asset requests still go to the hosting provider. Read the privacy and offline-use notes for details.