Skip to content
LSLab

How Does a Decoder Select an Output Line?

  • Starter
  • Article
  • Ages 10+
  • 5 min read
A black integrated circuit on a green board beside a test probe, with lab instruments blurred behind it.

A decoder reads a binary code at its inputs and switches on exactly one output line that matches the code. The other lines stay off. Because each code matches only one line, the circuit lets a short code pick one thing out of many, such as one memory cell.

Contents
Two lines enter the box; four lines lead to lamps, with the third filled yellow.
  • Binary code in (two input lines)
  • Decoder (rectangular box)
  • Four output lines (the thick green line is the chosen one)
  • Four lamps (the yellow lamp is the active line)

What you will learn

Before you start

You only need to know that a binary code is a string of bits, each a zero or a one. Every other term is explained as it comes up.

What does a decoder take in and turn on?

It takes a binary code and turns on one output line. The word decoder simply means to translate information from one format into another. In this circuit, a binary decoder takes n inputs and activates only one of its 2^n outputs according to that input, with every other output off.

The smallest practical case: a 2-bit decoder has 2 inputs and 4 outputs. Two inputs have four different combinations, and each combination is assigned to one of the four outputs. Even a NOT gate can be regarded as a 1-to-2 binary decoder.

How does each code pick a line?

The decoder turns on the output line that matches the input code. It selects the output line that matches the binary code at its inputs.

Say the two inputs carry the code one-zero. The circuit reads it as the third of the four possible values (zero-zero, zero-one, one-zero, one-one) and turns on the third output. Another code turns on another line. Two different codes never turn on the same line, and one code never turns on two lines.

The top row fills the third lamp yellow; the bottom row fills the fourth.
  • Code 1-0: yellow dot then black; third lamp filled yellow
  • Code 1-1: two yellow dots; fourth lamp filled yellow

The Enable pin and use in memory

The Enable pin can switch the whole circuit off. Some decoders have an extra input pin called Enable that controls the outputs. It also shows the link to the multiplexer: a binary decoder is a demultiplexer with an extra data line that is used to enable the decoder.

A typical use is picking a memory cell. You can treat the inputs as address signals, and each input combination defines a unique memory address. That is why this kind of circuit is commonly used as a memory address decoder in microprocessor memory applications.

Four lines connect to four stacked cells; the second is filled yellow, with an arrow pointing right.
  • Two input lines and the box on the left
  • Four output lines; the second is thick and green
  • Four stacked cells, the second filled yellow
  • Arrow leaving the second cell

Real-world example

Think of a lift with a panel of buttons: press a floor number and exactly one floor lamp lights. The code you enter decides which lamp comes on, and no lit lamp lights another. This is only a memory aid; a real lift does not necessarily use a decoder.

Common misunderstandings

A decoder can switch on several outputs at once. It turns on exactly one line for each code.

The number of outputs equals the number of inputs. With n inputs the circuit has up to 2^n output lines.

A decoder is the same as a multiplexer. A multiplexer gathers many signals into one, while a decoder switches on one line out of many according to a code.

Frequently asked questions

How many output lines does a 2-bit decoder have?

Four, one for each combination of its two inputs.

What is the Enable pin for?

It allows or switches off the outputs of the decoder.

What does a decoder do in a computer?

One use is picking a memory cell from an address.

Terms in this article

English and Vietnamese terms, with the meanings used here. Hover, tap or Tab to a term with a dotted underline for an explanation as you read.

decodermạch giải mã
A circuit that reads a binary code at its inputs and turns on exactly one matching output line.
output lineđường ra
One of the outputs of a decoder; only one line is on at a time.
binary codemã nhị phân
A string of bits, each a zero or a one, that stands for one value.
enable inputchân Enable
An extra input pin that allows or switches off the outputs of a decoder.

This article is not marked as viewed

Spotted something wrong or unsafe?

Tell the administrator by email. The message already has the article title and address.

Report this article
  • Macro view of a metal-pinned chip on a teal circuit board with small components behind it.
    Starter

    What Is a Microchip?

    Understand microchips, transistors and chip packages through a phone example, and distinguish a semiconductor material from a finished circuit.

    5 min read
  • An opened chip package revealing a silicon die and fine gold bond wires inside ceramic housing.
    Starter

    What Is Inside a Microchip?

    Explore the semiconductor base, transistors and chip package, and see how these parts form a component used in electronic devices.

    5 min read
  • An oscilloscope showing a high-low rectangular pulse beside a digital circuit board.
    Starter

    How Do Voltage Levels Represent Digital Signals?

    See how chips read HIGH and LOW from voltage, how logic families set thresholds, and how a transistor switch flips a level.

    5 min read
  • An exposed memory chip die with fine circuit regions and a row of gold wire-bond contacts on a board.
    Starter

    How Do Bits, Bytes and Machine Words Differ?

    Compare bits, nibbles, bytes and machine words by length, and understand why a byte has a fixed size while word length depends on the design.

    5 min read
See all articles of the topic

Sources

These sources are written for older readers. If they feel hard, read them with an adult.