Skip to main content
math

OR Calculator

Perform the bitwise OR operation on two numbers. Each output bit is 1 when at least one corresponding input bit is 1.

By Christopher FloiedPublished Updated

Results

A OR B (Decimal)

61

A (Binary)

111100

B (Binary)

1101

Result (Binary)

111101

How to Use This Calculator

1

Enter your input values

Fill in all required input fields for the OR Calculator. Follow the units and input format printed next to each field. Where a unit selector is available, choose the units that match your data.

2

Review your inputs

Double-check that all values are correct and match the units or format shown for each field. Incorrect units are the most common source of calculation errors and can produce results that are off by factors of 2, 10, or more.

3

Read the results

The OR Calculator computes the output in your browser and displays the results, with units clearly labeled, as soon as they are ready — no data sent to a server.

4

Explore parameter sensitivity

Try adjusting individual input values to see how the output changes. This is a quick and effective way to develop intuition about how different parameters influence the result and to identify which inputs have the largest effect.

When to Use This Calculator

  • •Use the OR Calculator when you need a quick mathematical result without writing out all the steps manually, saving time on repetitive calculations.
  • •Use it to verify hand calculations on tests or assignments and catch arithmetic mistakes.
  • •Use it when teaching or explaining mathematical concepts to others, demonstrating how changing inputs affects the result.
  • •Use it to explore the behavior of mathematical functions across a range of inputs.

Related Calculators

About OR Calculator

The OR operation compares each pair of corresponding bits and produces a 1 when at least one bit is 1. It produces 0 only when both bits are 0. OR is used for setting bits — to set bit k, OR the number with 2^k. It is also used for combining flags (permissions = READ | WRITE | EXECUTE), merging bit fields, and building more complex logic from basic gates. In digital circuits, OR gates are fundamental components alongside AND and NOT gates. This calculator computes the bitwise OR of two numbers with full binary visualization.

The Math Behind It

OR properties: A | 0 = A (identity), A | A = A (idempotent), A | ~A = all 1s, A | (all 1s) = all 1s (annihilation), commutative, associative. De Morgan's: ~(A | B) = ~A & ~B. OR is used for: setting bit k (value | (1 << k)), combining permission flags (readWrite = READ | WRITE), constructing subnet broadcast addresses (IP | ~SubnetMask). OR with AND forms the basis of sum-of-products logic expressions.

Formula Reference

OR Truth Table

0|0=0, 0|1=1, 1|0=1, 1|1=1

Variables: Output is 0 only when both inputs are 0

Worked Examples

Example 1: 60 OR 13

Compute bitwise OR of 60 and 13.

Step 1:60 = 111100₂
Step 2:13 = 001101₂
Step 3:OR: 111101₂

60 OR 13 = 61₁₀ = 111101₂

Common Mistakes & Tips

  • !Confusing | (bitwise OR) with || (logical OR) in programming.
  • !Thinking OR adds the numbers — it combines the bit patterns, not the values.

Related Concepts

Used in These Calculators

Calculators that build on or apply the concepts from this page:

Frequently Asked Questions

How do I set a specific bit?

OR the number with 2^k (or 1 << k). For example, to set bit 3 of value 5 (0101): 5 | 8 = 5 | 1000₂ = 1101₂ = 13.

Add the live OR Calculator to your site. Free to embed, with a link back to MegaCalc.