Skip to content
The Transistor as a Switch

The Transistor as a Switch

Everything a computer does — every calculation, every image on your screen, every message you send — ultimately reduces to billions of tiny switches flipping on and off, billions of times per second. This page connects the physical MOSFET you just learned about to that idea directly: how a piece of doped silicon becomes a digital “0” or “1,” and why that’s enough to build an entire computer.

Mapping voltage to logic levels

Digital electronics works by agreeing, in advance, on a convention: a voltage near 0 V represents logic 0 (false, off), and a voltage near the supply voltage (VDDV_{DD}, commonly 0.7–3.3 V in modern chips) represents logic 1 (true, on). Everything a chip “knows” or “computes” is encoded purely as patterns of these two voltage levels across millions or billions of wires.

Recall from The MOSFET that a MOSFET’s channel is either non-conductive (below VthV_{th}) or conductive (above VthV_{th}). That two-state behavior maps perfectly onto the two-state world of digital logic:

  • Gate voltage low → channel doesn’t form → transistor is an open circuit → acts like a switch stuck open
  • Gate voltage high → channel forms → transistor conducts → acts like a switch stuck closed
🧩 Think of it like… a light switch on a wall, except instead of your hand, another electrical signal flips it. Flip it off, and no current gets through no matter what's on the other side. Flip it on, and current flows freely. A MOSFET is exactly this, except the "flipping" is done by a voltage from another part of the circuit — which means the output of one switch can become the flipping signal for the next one, chaining switches together into circuits that make decisions.

Two flavors of switch: NMOS and PMOS

Digital chips use two complementary types of MOSFET, built with opposite doping:

TypeChannel materialTurns ON when…Behaves like a switch to…
NMOSN-type channel in P-type bodyGate voltage is HIGHGround (0 V)
PMOSP-type channel in N-type bodyGate voltage is LOWSupply voltage (VDDV_{DD})

NMOS transistors are good at pulling their output down to 0 V, while PMOS transistors are good at pulling their output up to VDDV_{DD}. Pairing one of each together — using the same input signal to drive both gates — is the basic recipe behind CMOS (Complementary MOS), the technology used in virtually every digital chip made today. That full pairing, and how it builds actual logic gates like AND, OR, and NOT, is covered in detail in CMOS Logic.

    flowchart TD
    IN["Input voltage (gate)"] --> NMOS["NMOS transistor"]
    IN --> PMOS["PMOS transistor"]
    NMOS -- "ON when input = HIGH<br/>pulls output to 0 V" --> OUT["Output"]
    PMOS -- "ON when input = LOW<br/>pulls output to V_DD" --> OUT
  

Building a switch into a simple inverter

Consider one NMOS transistor with its drain connected through a resistor (or, in real chips, a PMOS transistor) up to VDDV_{DD}, and its source connected to ground. The gate is the input; the drain is the output.

  • Input LOW → NMOS is off (open switch) → no path to ground → output gets pulled up to VDDV_{DD} → output HIGH.
  • Input HIGH → NMOS is on (closed switch) → output gets pulled down toward ground → output LOW.

Notice what just happened: the output is always the opposite of the input. This circuit is called a NOT gate (an inverter) — the simplest possible logic gate, and it’s built from nothing but one or two transistors acting as voltage-controlled switches. Every more complex logic gate (AND, OR, NAND, NOR, XOR) is built the same way: transistors wired together so that combinations of HIGH and LOW inputs produce a predictable HIGH or LOW output, following the rules of Boolean logic. This is explored fully starting with Logic Gates.

Why does a switch-based approach let you build arithmetic, not just logic? Because binary numbers themselves are made of 0s and 1s (see Binary and Bits), and Boolean logic gates can be wired together to perform addition, comparison, and every other operation a processor needs — entirely out of switches turning on and off.

Why the switch model is powerful

A few properties make MOSFET switches an extraordinarily good foundation for computing:

  1. They’re nearly binary already — the sharp turn-on behavior at VthV_{th} means there’s very little “in-between” state, which keeps noise from corrupting signals.
  2. They draw almost no static power — because the gate is insulated (see The MOSFET), a switch that’s holding steady at 0 or 1 draws almost no current, unlike a BJT-based switch.
  3. They’re tiny and shrinkable — a MOSFET can be manufactured at a scale of tens of nanometers, letting billions fit on a single chip (see Moore’s Law and Scaling).
  4. They’re fast — modern transistors can switch on and off billions of times per second, which is what allows gigahertz-clocked processors to exist.

From one switch to a whole computer

A single transistor switch can’t do much on its own. But wire a handful of them together and you get a logic gate. Wire hundreds of logic gates together and you get an adder or a memory cell. Wire billions of those together, organized by careful chip design, and you get a modern processor. The entire chain — from a doped silicon crystal, to a voltage-controlled channel, to a switch, to a gate, to a working chip — is the story this knowledge base tells, continuing next in Digital Logic.

Key takeaways

  • Digital logic represents information as two voltage levels: LOW (logic 0) and HIGH (logic 1).
  • A MOSFET’s sharp on/off transition at VthV_{th} makes it a natural voltage-controlled switch for these two levels.
  • NMOS transistors pull outputs toward 0 V when on; PMOS transistors pull outputs toward VDDV_{DD} when on.
  • Pairing NMOS and PMOS transistors (CMOS) is the basis for building all standard logic gates, starting with the simple inverter (NOT gate).
  • Chaining transistor switches into gates, and gates into circuits, is how a physical material becomes a computer — see Logic Gates and CMOS Logic.