# Bitwise OR operation

17 February 2024 (Updated 17 February 2024)

The Bitwise OR operation – commonly expressed as the symbol `|`

– takes two bit patterns of equal length and performs the logical inclusive OR operation on each pair of corresponding bits.

The inclusive OR operation works as follows:

Bit a | Bit b | Result |

0 | 0 | 0 |

0 | 1 | 1 |

1 | 0 | 1 |

1 | 1 | 1 |

If either of the bits is 1, the result is 1. Otherwise, the result is 0.

For example, you can apply the bitwise OR operation in JavaScript on the numbers `170`

and `204`

using:

```
170 | 204
// 238
```

This is equivalent to:

```
10101010 (170)
OR 11001100 (204)
-----------
11101110 (238)
```

Tagged:
Computing