Beginner

OR Calculator — Bitwise OR of Two Integers

Enter two non-negative integers in decimal, binary or hexadecimal to compute their bitwise OR, with the result in all three bases and a step-by-step bit breakdown.

Input base

Non-negative integer in the selected base
Non-negative integer in the selected base
A OR B (decimal)
61
Result (decimal)
61
Result (binary)
111101
Result (hex)
0x3D
A in binary
111100
B in binary
001101
Bits set in result
5
Bit-by-bit OR (most significant first)
1

Bit 5

1 OR 0 = 1
2

Bit 4

1 OR 0 = 1
3

Bit 3

1 OR 1 = 1
4

Bit 2

1 OR 1 = 1
5

Bit 1

0 OR 0 = 0
=

Bit 0

0 OR 1 = 1
Ir-riżultati huma stimi għal informazzjoni ġenerali biss u mhumiex parir professjonali — dejjem ivverifika riżultati importanti b'mod indipendenti qabel ma tiddependi fuqhom. Aqra d-dikjarazzjoni ta' ċaħda sħiħa.
Tweġiba malajr

Kif jaħdem dan il-kalkulatur?

Bitwise OR sets each output bit to 1 whenever either input bit is 1; the output bit is 0 only when both inputs are 0. Convert both integers to binary, pad to equal length, OR each column, then convert back. In most languages this is the | operator. Example: 60 | 13 = 61 because 0111100 | 0001101 = 0111101.

Formula
A | B: each output bit = 1 if the corresponding bit in A or in B (or both) is 1; 0 only when both bits are 0
How this is calculated

Bitwise OR operates on integer values by comparing them bit by bit simultaneously. For each bit position, the rule is simple: the output is 1 if either (or both) of the corresponding input bits is 1, and 0 only when both input bits are 0. This mirrors the logical OR truth table: 0 OR 0 = 0; 1 OR 0 = 1; 0 OR 1 = 1; 1 OR 1 = 1.

To perform the operation manually, first convert both integers to binary, padding the shorter number with leading zeros so they share the same length. Then apply the OR rule column by column from the most significant bit (left) to the least significant bit (right). Reading the resulting binary string back gives the result, which can then be converted to decimal or hexadecimal.

Bitwise OR appears throughout computing. In Unix/Linux file permissions, each permission (read = 4, write = 2, execute = 1) is a bit, and OR combines them: 4 | 2 = 6 gives read + write. Hardware drivers use OR to set specific bits in control registers without changing others. In most programming languages — C, Java, Python, JavaScript, Rust — bitwise OR is the pipe character (|), so 60 | 13 evaluates to 61.

Mistoqsijiet frekwenti

Logical OR (||) treats operands as true/false and returns a boolean — any non-zero integer is treated as true. Bitwise OR (|) operates on all bits of both integers simultaneously, returning an integer result. For example, 2 || 4 is true in many languages, but 2 | 4 = 6.

60 in binary is 00111100 and 13 is 00001101. Applying OR column by column: 00111100 | 00001101 = 00111101, which is 61 in decimal. Only bit 1 (value 2) was 0 in both inputs, so it stays 0; every other bit set in either number is set in the output.

To set bit n (0-indexed from the right), OR the value with a bitmask of 1 shifted left by n positions. For example, to set bit 3 of 5 (binary 00000101): bitmask = 1 << 3 = 8 (binary 00001000); result = 5 | 8 = 13 (binary 00001101). This leaves all other bits unchanged.

Magħruf ukoll bħala

bitwise or calculator
binary or calculator
or gate calculator
logical or integers
bitwise operation calculator
integer or hex decimal binary
or bit operation
pipe operator calculator

APA

TG we-Calculate Editorial Team. (2026). OR Calculator — Bitwise OR of Two Integers [Online calculator]. TG we-Calculate. https://we-calculate.com/mt/calculator/or-calculator

Chicago

TG we-Calculate Editorial Team. "OR Calculator — Bitwise OR of Two Integers." TG we-Calculate. 2026. https://we-calculate.com/mt/calculator/or-calculator.

IEEE

TG we-Calculate Editorial Team, "OR Calculator — Bitwise OR of Two Integers," TG we-Calculate, 2026. [Online]. Available: https://we-calculate.com/mt/calculator/or-calculator

BibTeX

@misc{wecalculate_or_calculator, title = {OR Calculator — Bitwise OR of Two Integers}, author = {{TG we-Calculate Editorial Team}}, howpublished = {\url{https://we-calculate.com/mt/calculator/or-calculator}}, year = {2026}, note = {TG we-Calculate} }

Dan il-kalkulatur għenek?