# Bitwise Calculator

URL: https://speedycalculator.com/calculators/math/bitwise/
Last updated: 2026-10-30

> The bitwise calculator performs AND, OR, XOR, NOR, NAND and XNOR on two binary, octal or decimal numbers with a chosen bit width, and shows the result in binary, decimal (signed and unsigned), octal and hexadecimal.

## Inputs

- Representation
- Number format
- Number 1
- Number 2
- Operation

## Results

- Result (binary)
- Result (decimal, unsigned)
- Result (decimal, signed two's complement)
- Result (octal)
- Result (hexadecimal)
- Bit by bit

## Formula

```
AND: 1 if both bits are 1 · OR: 1 if either is 1 · XOR: 1 if they differ
NOR = NOT OR · NAND = NOT AND · XNOR = NOT XOR
```

## Explanation

Bitwise operations are the native language of processors. They pack flags into one integer, mask out bytes, compute hashes and checksums, and power graphics, compression and cryptography.

### How to use the Bitwise Calculator

- **Representation**
- **Number format**
- **Number 1**
- **Number 2**
- **Operation**

Everything is calculated in your browser, so results appear instantly and nothing you type is sent to a server.

### How it works

Choose the representation (bit width), the number format and the operation, then enter both numbers. The bit-by-bit layout shows exactly which bits produced the result.

## Worked example

Inputs — Representation: 8-bit; Number format: Binary; Number 1: 1011; Number 2: 0110; Operation: AND.

Results — **Result (binary) = 0000 0010**; Result (decimal, unsigned) = 2; Result (decimal, signed two's complement) = 2; Result (octal) = 2; Result (hexadecimal) = 2; Bit by bit = 0000 1011
AND 0000 0110
─────────
= 0000 0010.

## Key terms

- **Two's complement**: The usual way computers store negative integers.

## FAQ

**What does 1011 AND 0110 give?**
0010.

**Which operations are universal?**
NAND and NOR – every logic circuit can be built from either one.

**What is XNOR used for?**
Equality testing: it outputs 1 when both bits are the same.

**Why are results different for different widths?**
Inverting operations (NOR, NAND, XNOR) turn leading zeros into ones.


## Sources

- [Wolfram MathWorld – Binary](https://mathworld.wolfram.com/Binary.html)
- [Harvard CS50 – Binary and bitwise operators](https://cs50.harvard.edu/x/)
