NumForge LogoNumForge
Explore
Digital Electronics ToolsFree Interactive Tool

Bitwise OR Calculator

Compute bitwise OR (|) between two binary numbers to set and combine bit flags. Designed for software developers, electrical engineers, students, and computer architecture researchers requiring deterministic client-side accuracy.

Engine: Client-Side Verified (0ms Latency)

Enter binary or decimal numbers.

Calculated Output

Primary Representation
Calculating...

Step-by-Step Mathematical Proof

Active Derivation
Ready. Enter input above to generate derivation.
Concept

What Is Bitwise OR Calculator?

The Bitwise OR operator (|) compares corresponding bits of two operands. A bit in the result is 1 if at least one of the input bits is 1. The result is 0 only when both input bits are 0.

Methodology

How Does It Work?

Apply the logical OR truth table across all columns: 0 | 0 = 0, 0 | 1 = 1, 1 | 0 = 1, 1 | 1 = 1.

Formula & Rules

Mathematical Algorithm

C_i = A_i \lor B_i \quad \text{for all bit positions } i
Worked Problem

Step-by-Step Example

Bitwise OR 11000000 | 00001100: 11000000 | 00001100 ---------- 11001100_2 (decimal 204).

Important Rules & Edge Cases

  • 0 | 0 = 0; all other combinations result in 1.
  • ORing with 1 sets a bit; ORing with 0 leaves a bit unchanged.

Practical Applications in Engineering

  • Setting configuration flags (e.g. flags |= FLAG_READ_ONLY).
  • Combining color channels into single pixel values.
  • Activating peripheral hardware pins in microcontrollers.

Common Mistakes to Avoid

  • Caution: Confusing bitwise OR (|) with logical OR (||).
  • Caution: Thinking 1 | 1 produces 0 with carry (that is addition, not OR).
FAQ

Frequently Asked Questions

How do you set a specific bit to 1 in a register?

Use bitwise OR with a shifted bitmask: register |= (1 << bitIndex).