Skip to content
Hex Calculator

Hex OR Calculator

Bitwise OR two hex values and see the result bit by bit — the operation code uses to combine flag bits without disturbing bits already set.

Bit width
Hexadecimal
0xFF
Decimal
255

Binary, aligned by bit

A: 11110000
B: 00001111
=: 11111111
Swapnil Sanghvi

Built by

Swapnil Sanghvi

Full-Stack Web Developer & WordPress Developer

Swapnil Sanghvi is a full-stack web and WordPress developer, UI designer, and full-time freelancer who builds and maintains Hex Calculator.

Hex OR Calculator tool preview card from Hex Calculator
Share preview: this is the card that appears when you share the Hex OR Calculator page on social media.

Further reading: Bitwise operation — Wikipedia

How to OR Two Hex Values

Line the two values up bit by bit. For each position, the result bit is 1 if either input has a 1 there — the only way a result bit stays 0 is if both inputs are 0 in that position. It's the most permissive of the bitwise operations: any single 1 wins.

Hex OR Example, Step by Step

1200 OR 0034 = 1234

0x1200 | 0x0034 = 0x1234

  0001 0010 0000 0000
| 0000 0000 0011 0100
---------------------
  0001 0010 0011 0100
StepDescriptionResult
Align bits1200 = 0001001000000000, 0034 = 000000000011010016 bits each
OR each bit paireach side contributes the bits the other side doesn't haveno overlapping bits to lose
Resultthe two values merge without conflict0x1234

Since 1200 and 0034 don't share any 1 bits, ORing them simply merges the two — this is the classic pattern for combining a high-byte value and a low-byte value into one number.

Where Hex OR Actually Comes Up

Setting a Specific Flag Bit

ORing a status value against a single-bit mask sets that bit to 1 while leaving every other bit exactly as it was — the standard way to turn on one option flag.

flags | 0x02 sets bit 1

Combining Multiple Option Flags

ORing several single-bit flag constants together builds one combined value representing all the selected options at once, which is how flag-based APIs let you pass multiple options in one argument.

READ | WRITE | EXEC

Merging Two Non-Overlapping Byte Values

When a high byte and low byte don't share any set bits, ORing them together combines the two into a single value — a common step when reassembling a multi-byte number from its parts.

0x1200 | 0x0034 -> 0x1234

Why Use This Calculator Instead of Doing It by Hand

  • Shows aligned binary for both operands and the result, not just the final hex
  • Supports 8/16/32/64-bit widths so leading zero bits are handled correctly
  • Runs entirely in your browser — nothing you type gets sent anywhere
  • Includes AND, XOR, and NOT in the same calculator if you need to switch operations

Limitations

  • Combines two values at a time — chain results manually if you need to OR three or more values together.
  • The bit-width setting only controls how the binary breakdown is padded and displayed — it doesn't change which bits the OR itself compares.

Frequently Asked Questions

How does bitwise OR work?

OR compares two values bit by bit — a result bit is 1 if either input (or both) has a 1 in that position, and 0 only when both inputs are 0 there.

What is OR used for in practice?

Combining flags — ORing a value with a flag bit sets that bit without changing any other bit in the value, which is the standard way multiple option flags get combined into one number.

What's the result of ORing anything with 0?

The original value, unchanged — 0 contributes no 1 bits, so ORing with 0 is effectively a no-op, the same way adding 0 doesn't change a sum.

What's the result of ORing anything with all-1s (like 0xFF)?

All 1s in those positions — since OR only needs one side to be 1, ORing against a value with every bit set forces every one of those bits to 1 in the result, regardless of the other operand.

How is OR different from addition?

Addition can carry between bit positions (1+1 carries to the next bit); OR never carries — each bit position is combined completely independently of its neighbors.