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
Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
Conas a oibríonn an t-áireamhán seo?
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.
Foirmle
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.
Ceisteanna coitianta
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.
Ar a dtugtar freisin
TG we-Calculate Editorial Team. (2026). OR Calculator — Bitwise OR of Two Integers [Online calculator]. TG we-Calculate. https://we-calculate.com/ga/calculator/or-calculator
TG we-Calculate Editorial Team. "OR Calculator — Bitwise OR of Two Integers." TG we-Calculate. 2026. https://we-calculate.com/ga/calculator/or-calculator.
TG we-Calculate Editorial Team, "OR Calculator — Bitwise OR of Two Integers," TG we-Calculate, 2026. [Online]. Available: https://we-calculate.com/ga/calculator/or-calculator
@misc{wecalculate_or_calculator, title = {OR Calculator — Bitwise OR of Two Integers}, author = {{TG we-Calculate Editorial Team}}, howpublished = {\url{https://we-calculate.com/ga/calculator/or-calculator}}, year = {2026}, note = {TG we-Calculate} }
Ar chabhraigh an t-áireamhán seo leat?
