# Why is a half adder implemented with XOR gates instead of OR gates?

Half adder circuits are implemented with XOR gates for the summing. Why can't the adding function be implemented with OR gates? What is the difference between using XOR gates and OR gates?

• OR gates don't add two bits; XOR gates do add 2 bits. – Andy aka Apr 25 '15 at 20:46

0 + 0 = 0 0
0 + 1 = 0 1
1 + 0 = 0 1
1 + 1 = 1 0


The ones place of a single-bit addition is equivalent to the exclusive OR operation, not the OR operation. Hence XOR is used instead. Note that this is not the only way to build a half adder, you can do it without using an XOR gate, but it requires more gates.

For example, here is a half adder built with only AND, OR, and NOT gates:

You can see here that an OR gate is used to form the ones place output, but an AND gate is also necessary to turn off that output when the carry output is set.

One thing to note is that these adders are usually implemented not with several separate gates, but as one optimized unit, like this:

The construction with logic gates is just a functionally equivalent version of the actual implementation.

• thanks for your answer. and in other cases why we are having XOR gates, instead of OR gates – natarajan physicist Apr 25 '15 at 18:54
• @natarajan, besides the fact that XOR conditions frequently need to be evaluated in boolean logic, they also conventiently behave as a selective logic inversion - that is, "invert this signal only when this other condition is true." The truth table tells you everything you need to know. OR gates are fundamentally different, because they output a logic high when any input is high. – Sean Boddy Apr 26 '15 at 9:33
• Didn't realize that was a question. XOR gates are also used in linear feedback shift registers (including CRC computation and pseudorandom number generation), parity generation, encryption, comparison (for things like convolution), etc. – alex.forencich Apr 26 '15 at 17:07