OR Calculator
CU-25Enter two numbers such as 12 and 10 and get their bitwise OR in decimal, signed decimal, hex and binary. A result bit is 1 when either input bit is 1.
Runs in your browser. Nothing is uploaded.
Number pairs, one per line (12 10, 12 OR 10 or 12 | 10)
OR results
How to use it
- Type or paste one pair of numbers per line, for example 12 10, 12 OR 10 or 12 | 10.
- Pick the bit width (8, 16, 32 or 64) and how numbers without a prefix are read.
- Press Calculate OR for decimal, signed, hex and binary results, Binary view to line the bits up, or Truth table for the one-bit gate.
- Copy the result or download it as a text file.
What bitwise OR does
OR compares two numbers bit by bit. A result bit is 1 if at least one of the two input bits is 1, and 0 only when both are 0. That makes it the usual way to switch flags on: 4 OR 1 is 5, and 12 OR 10 is 14 (1100 OR 1010 gives 1110). Unlike NAND, OR has no NOT step, so the width rarely changes a positive answer.
Writing the input
Separate the two numbers with a space or comma, the word OR, or the | symbol. Numbers can be decimal, or written with 0x for hex, 0b for binary and 0o for octal, or you can set bare numbers to binary or hexadecimal. A negative decimal is stored as the unsigned value of the chosen width. A value that does not fit the width is an error, and 64-bit numbers are exact.
What it is not
This is the bitwise operator (|) on whole numbers, not the logical OR of true and false values, and it is not a circuit simulator. Each line has exactly two operands. The Binary view lines up both inputs and the result, and the Truth table action prints the one-bit table.
Error messages and what to do
| Message | What it means | Fix |
|---|---|---|
Line 1: write two numbers such as 12 10 or 12 OR 10 (got "abc"). | The line does not hold exactly two numbers, optionally with the operator word between them. | Write two numbers, for example 12 10 or 12 OR 10. |
Line 1: 300 does not fit in 8 bits (allowed -128 to 255). | A number is too big for the chosen bit width. The tool refuses it instead of cutting bits off. | Choose a wider bit width or use a smaller number. |
Questions people ask
How do I calculate bitwise OR?
Write both numbers in binary, line them up, and set each result bit to 1 if either input bit is 1. For 12 and 10 that is 1100 OR 1010 = 1110, which is 14. The Binary view does this layout for you.
What is the OR truth table?
Inputs 0,0 give 0; 0,1 give 1; 1,0 give 1; 1,1 give 1. The output is 0 only when both inputs are 0. Press Truth table to print it.
What is the difference between | and ||?
The single bar | is bitwise OR on every bit of two numbers. The double bar || in many languages is logical OR on true or false values. This tool does the bitwise one.
How is OR used to set flags?
Each flag is one bit. OR-ing a flag value into a number turns that bit on and leaves the others alone: 4 OR 1 gives 5, so both the 4 and 1 flags are set. This is common for permission and option masks.
Can I mix hex and decimal?
Yes. Each number is read on its own, so 0xF0 10 works. Only numbers without a prefix follow the base option you choose, which is decimal by default.
What happens with negative numbers?
A negative decimal is stored in two's complement at the chosen width, so -1 at 8 bits is 255 (all ones). The tool shows both the unsigned and the signed result.
About this tool
Bitwise OR sets a result bit to 1 when at least one of the two input bits is 1, so OR is how flags are combined: 4 OR 1 is 5. Each line holds two whole numbers, separated by a space or comma, by the word OR or by the | symbol. Numbers can be decimal, 0x hex, 0b binary or 0o octal, or you can choose binary or hexadecimal for numbers without a prefix. A negative decimal is stored as the matching unsigned value of the chosen width, and a number that does not fit is an error instead of being cut off. 64-bit values are exact. This is the bitwise operator (|), not the logical OR of two true or false values, and only two operands per line are supported.