Skip to content
Computer ScienceISC Class 12 · Computer Hardware

Half and Full Adders, Encoders, Decoders and Multiplexers (ISC Class 12 Computer Science)

Updated 17 October 2026 · Draft, not yet fact-checked

A half adder adds two bits: Sum = A⊕B, Carry = AB. A full adder adds three bits: Sum = A⊕B⊕Cin, Carry-out = AB + Cin(A⊕B), and can be built from two half adders and an OR gate. An encoder turns one active line into a binary code, a decoder does the reverse, and a multiplexer selects one of many inputs.

Notice that the full adder is two half adders plus an OR gate: Sum comes from HA2, and Cout is C1 OR C2.

Illustration drawn for QuestionBuddy.

Understand Half and Full Adders, Encoders, Decoders and Multiplexers

Half adder. Adds bits A and B.

ABSumCarry
0000
0110
1010
1101

Sum = A⊕B (XOR gate) and Carry = A·B (AND gate). It cannot take a carry-in.

Full adder. Adds A, B and a carry-in Cin. Sum = A⊕B⊕Cin; Carry-out = AB + Cin(A⊕B), which also equals AB + ACin + BCin (carry is 1 when at least two inputs are 1). Sum is 1 when an odd number of inputs are 1.

Full adder from two half adders. HA1 takes A and B and gives S1 = A⊕B and C1 = AB. HA2 takes S1 and Cin and gives Sum = S1⊕Cin and C2 = S1·Cin. An OR gate gives Cout = C1 + C2. That uses 2 XOR, 2 AND and 1 OR gate: five gates. Several full adders in a chain add multi-bit numbers, the carry-out of each stage feeding the next stage.

Encoder. Has 2^n input lines (one active at a time) and n output lines giving the binary index of the active line. A 4-to-2 encoder with inputs D0 to D3: Y1 = D2 + D3 and Y0 = D1 + D3. If two inputs are active at once the plain encoder gives a wrong code; a priority encoder fixes that.

Decoder. Has n input lines and 2^n output lines and activates exactly one output for each input code. A 2-to-4 decoder with inputs A (high) and B: D0 = A'B', D1 = A'B, D2 = AB', D3 = AB. Each output is a minterm, so a decoder with OR gates can build any function.

Multiplexer (MUX). Selects one of 2^n data inputs using n select lines and sends it to one output. A 2-to-1 MUX: Y = S'I0 + S·I1. A 4-to-1 MUX with selects S1, S0: Y = S1'S0'I0 + S1'S0·I1 + S1S0'·I2 + S1S0·I3. A MUX with data inputs tied to 0 or 1 realises a truth table directly.

Basic gates, NAND and NOR conversion are in the previous topic.

Half and Full Adders, Encoders, Decoders and Multiplexers: key facts

Half adder
  • Sum = A⊕B
  • Carry = A·B
  • 1 XOR gate and 1 AND gate
  • Adds two bits only
1 + 1 = 10 in binary: Sum 0, Carry 1.
Full adder
  • Sum = A⊕B⊕Cin
  • Cout = AB + Cin(A⊕B)
  • Cout = AB + ACin + BCin
  • Adds three bits
Built from 2 half adders and 1 OR gate.
Encoder 4-to-2 and decoder 2-to-4
EncoderY1 = D2 + D3
EncoderY0 = D1 + D3
DecoderD0 = A'B', D1 = A'B, D2 = AB', D3 = AB
Each decoder output is a minterm.
Multiplexer
  • 2-to-1: Y = S'I0 + S·I1
  • 4-to-1: Y = S1'S0'I0 + S1'S0·I1 + S1S0'·I2 + S1S0·I3
  • n select lines choose from 2^n inputs
The select lines form the binary index of the chosen input.

How to answer Half and Full Adders, Encoders, Decoders and Multiplexers questions

Use this routine for adder and MUX questions.

  1. 1Write the truth table of the circuit before choosing gates.
  2. 2For adders, read Sum as the odd-parity column and Carry as the "at least two" column.
  3. 3For a full adder from half adders, draw HA1 on A and B, HA2 on (HA1 sum) and Cin, and OR the two carries.
  4. 4For a multiplexer, treat the select lines as the binary index and pick that input.
  5. 5To implement a function with a MUX, connect the variables to the select lines and tie each data input to the function value of that row.
  6. 6Verify one input row end to end.

Half and Full Adders, Encoders, Decoders and Multiplexers in real life

The idea, met in an everyday situation. Answer the question in your own words, then compare with the model answer. The one-line hook is what to remember.

Counting people at two doors

Suppose a hall counter adds the entry bit from door A and the entry bit from door B, each 0 or 1, to show a 2-bit count.

If both doors register an entry (A = 1, B = 1), what are the sum and carry bits and what count is displayed?

Try it first, then show the solutionSolution
  1. Half adder: Sum = 1⊕1 = 0, Carry = 1·1 = 1.
  2. Carry and Sum read together as 10 binary.

Answer: Sum 0, carry 1, displayed count 2.

Memory hook: Two ones make "10".

Choosing one camera feed

Suppose a control room has four camera feeds I0 to I3 and two buttons S1 S0 that choose which feed goes to the screen.

The buttons are set to S1 = 1 and S0 = 0. Which feed is shown?

Try it first, then show the solutionSolution
  1. The buttons give the binary index 10, which is 2.
  2. The multiplexer selects I2.

Answer: Feed I2 is shown.

Memory hook: Select lines spell the input number.

Tricks to remember Half and Full Adders, Encoders, Decoders and Multiplexers

Short memory aids. Say each one aloud once, then use it on a question the same day.

  • Sum is odd, carry is two or more

    Sum = 1 when an odd number of inputs are 1; carry = 1 when at least two are 1.

    Use it when: Filling adder tables.

  • Encoder squeezes, decoder spreads

    Encoder: many lines to a short code. Decoder: a short code to one of many lines.

    Use it when: Telling the two apart.

  • MUX = railway points

    Select lines set the points so only one track (input) reaches the output.

    Use it when: Understanding the multiplexer.

  • Two halves and an OR

    Full adder = half adder + half adder + OR of the carries.

    Use it when: Drawing the full adder.

Half and Full Adders, Encoders, Decoders and Multiplexers: solved examples

Ordered from board level to HOTS. Try each one before you open the solution.

Example 1: Half adder output · 1 mark · MCQBoard level

For a half adder with A = 1 and B = 1, the Sum and Carry are
(a) 1, 1 (b) 0, 1 (c) 1, 0 (d) 0, 0

Try it first, then show the solutionSolution
  1. Sum = 1⊕1 = 0.
  2. Carry = 1·1 = 1.

Answer: (b) Sum 0, Carry 1

Example 2: Full adder rows · 3 marks · Short answerHarder board level

Find Sum and Cout of a full adder for (A, B, Cin) = (1, 1, 1) and (1, 0, 1). Check against ordinary binary addition.

Try it first, then show the solutionSolution
  1. (1, 1, 1): Sum = 1⊕1⊕1 = 0⊕1 = 1; Cout = AB + Cin(A⊕B) = 1 + 1·0 = 1. 1 + 1 + 1 = 11 in binary. (1.5 marks)
  2. (1, 0, 1): Sum = 1⊕0⊕1 = 1⊕1 = 0; Cout = 0 + 1·(1⊕0) = 1. 1 + 0 + 1 = 10 in binary. (1.5 marks)

Answer: (1, 1, 1): Sum 1, Cout 1. (1, 0, 1): Sum 0, Cout 1.

Example 3: Full adder from half adders · 4 marks · Short answerHarder board level

Draw the structure of a full adder using two half adders and state the gate count. Trace it for A = 1, B = 1, Cin = 0.

Try it first, then show the solutionSolution
  1. HA1 on A and B gives S1 = A⊕B and C1 = AB; HA2 on S1 and Cin gives Sum = S1⊕Cin and C2 = S1·Cin; an OR gate gives Cout = C1 + C2. (2 marks)
  2. Gates: 2 XOR, 2 AND, 1 OR, total 5. (1 mark)
  3. Trace for 1, 1, 0: S1 = 0, C1 = 1; Sum = 0⊕0 = 0, C2 = 0; Cout = 1 + 0 = 1. The result is 10 binary, which is 1 + 1 + 0. (1 mark)

Answer: Two half adders and an OR gate (2 XOR, 2 AND, 1 OR). For 1, 1, 0: Sum 0, Cout 1.

Example 4: XOR with a 4-to-1 multiplexer · 3 marks · Short answerHarder board level

Implement F = A'B + AB' using a 4-to-1 multiplexer. State the connections to the select lines and to the data inputs I0 to I3.

Try it first, then show the solutionSolution
  1. Connect S1 = A and S0 = B. The selected input is I(2A + B). (1 mark)
  2. The truth table of F is 0, 1, 1, 0 for AB = 00, 01, 10, 11. (1 mark)
  3. So I0 = 0, I1 = 1, I2 = 1, I3 = 0. Check A = 1, B = 0: index 2, I2 = 1, F = 1. (1 mark)

Answer: S1 = A, S0 = B, I0 = 0, I1 = 1, I2 = 1, I3 = 0.

Example 5: Case: device selection and a faulty encoder · 4 marks · Case-basedHOTS / competency

Suppose a controller uses a 2-to-4 decoder (inputs A, B) to switch on one of four devices D0 to D3, and a plain 4-to-2 encoder to report which device switch is pressed.
(i) Which device is activated for A = 1, B = 0? (1 mark)
(ii) Write the encoder output expressions Y1 and Y0. (1 mark)
(iii) The user presses D1 and D2 together. Find (Y1, Y0) and say what goes wrong. (2 marks)

Try it first, then show the solutionSolution
  1. (i) D2 = AB' = 1 for A = 1, B = 0, so device D2.
  2. (ii) Y1 = D2 + D3 and Y0 = D1 + D3.
  3. (iii) D1 = D2 = 1: Y1 = 1 + 0 = 1, Y0 = 1 + 0 = 1, giving 11, which is the code of D3. The plain encoder reports a device that was not pressed; a priority encoder is needed.

Answer: (i) D2 (ii) Y1 = D2 + D3, Y0 = D1 + D3 (iii) 11, a wrong code for D3; use a priority encoder

Where students lose marks in Half and Full Adders, Encoders, Decoders and Multiplexers

The slips examiners see most often, and what to write instead.

  • Mistake: Using OR for the half adder sum

    For 1 + 1 an OR gate gives 1 but the sum bit is 0 with a carry.

    Wrong working

    Sum = A + B

    Right working

    Sum = A⊕B

    Do this: Sum is XOR; carry is AND.

    Usually costs: 1 mark

  • Mistake: Full adder carry without the sum term

    Cout needs both AB and Cin(A⊕B).

    Wrong working

    Cout = AB + Cin

    Right working

    Cout = AB + Cin(A⊕B)

    Do this: Check with A = 0, B = 0, Cin = 1: Cout must be 0.

    Usually costs: 1 mark

  • Mistake: Reading the multiplexer select lines backwards

    S1 is the high-order bit of the input index.

    Wrong working

    S1 = 1, S0 = 0 selects I1

    Right working

    S1 = 1, S0 = 0 selects I2

    Do this: Convert the select bits to decimal.

    Usually costs: 1 mark

Exam tips

  • Always give the truth table before the circuit; it earns separate marks.
  • Label the intermediate wires (S1, C1, C2) in a full adder diagram.
  • State the gate count when you build a full adder from half adders.
  • For a decoder, write each output as a minterm of the inputs.
  • Test one input row on your final diagram.

Practice questions on Half and Full Adders, Encoders, Decoders and Multiplexers

Write each answer on paper first. Open the hint only if you are stuck, and the answer only when you have finished.

  1. Q1 · 1 mark · MCQBoard level

    How many output lines does a 3-to-8 decoder have?
    (a) 3 (b) 4 (c) 8 (d) 16

    Hint

    n inputs give 2^n outputs.

    Answer

    (c) 8

  2. Q2 · 2 marks · Short answerBoard level

    Write the truth table and the Boolean expressions of the Sum and Carry of a half adder.

    Hint

    XOR and AND.

    Answer

    (A, B) = 00, 01, 10, 11 give (Sum, Carry) = (0, 0), (1, 0), (1, 0), (0, 1). Sum = A⊕B = A'B + AB' and Carry = AB.

  3. Q3 · 4 marks · Short answerHarder board level

    Two 2-bit numbers 11 and 01 are added using two full adders in a chain (least significant bit first, initial carry 0). Show the Sum and carry of each stage and the final result.

    Hint

    The carry-out of stage 1 is the carry-in of stage 2.

    Answer

    Stage 1 (1 + 1 + 0): Sum 0, Cout 1. Stage 2 (1 + 0 + 1): Sum 0, Cout 1. Result: final carry 1, sum bits 0 and 0, giving 100 binary = 4, which equals 3 + 1.

  4. Q4 · 3 marks · Short answerHarder board level

    Build a 2-to-1 multiplexer Y = S'I0 + S·I1 from basic gates. State the gate count, and find Y for S = 1, I0 = 0, I1 = 1.

    Hint

    One NOT, two ANDs and one OR.

    Answer

    One NOT (for S'), two AND gates (S'·I0 and S·I1) and one OR gate: 4 gates. For S = 1: S' = 0, so Y = 0·0 + 1·1 = 1.

  5. Q5 · 4 marks · Case-basedHOTS / competency

    Show how one 3-to-8 decoder and two OR gates give the Sum = Σm(1, 2, 4, 7) and Cout = Σm(3, 5, 6, 7) of a full adder. Why is Sum an odd-parity function?

    Hint

    Each decoder output is a minterm.

    Answer

    Connect (A, B, Cin) to the decoder. OR the outputs D1, D2, D4, D7 to get Sum, and D3, D5, D6, D7 to get Cout. Minterms 1, 2, 4, 7 are the codes 001, 010, 100, 111, each having an odd number of 1s, so Sum is 1 exactly when an odd number of inputs are 1.

Test your recall

Answer in your head or on paper first, then open the card. Pulling an answer out of memory makes it stick far better than re-reading.

  1. 1.What gates form a half adder?Show answer

    One XOR (sum) and one AND (carry).

  2. 2.Write the carry-out of a full adder.Show answer

    Cout = AB + Cin(A⊕B).

  3. 3.How many half adders and other gates make a full adder?Show answer

    Two half adders and one OR gate.

  4. 4.What does a decoder do?Show answer

    Activates exactly one of 2^n outputs according to the n-bit input code.

  5. 5.How many select lines has a 4-to-1 multiplexer?Show answer

    Two.

  6. 6.What problem does a priority encoder solve?Show answer

    It gives a correct code when more than one input is active.

Half and Full Adders, Encoders, Decoders and Multiplexers: frequently asked questions

What is the difference between a half adder and a full adder?

A half adder adds two bits and has no carry-in; a full adder adds two bits plus a carry-in and so can be chained for multi-bit addition.

How many gates are needed to make a full adder from two half adders?

Five: two XOR gates, two AND gates and one OR gate.

What is the difference between an encoder and a decoder?

An encoder converts one active input line into a binary code; a decoder converts a binary code into one active output line.

What is a multiplexer used for?

It selects one of several data inputs and passes it to a single output, controlled by the select lines; it can also implement Boolean functions.