Switch
A switch is a device that opens or closes a path for current, and a transistor switch does so electronically, with no moving parts, in response to a small control signal. When a bipolar transistor is used this way, it is driven to one of two extremes: cutoff, where almost no current flows and the path is open, or saturation, where the path is closed and the voltage across it is only a few tenths of a volt. Almost all digital electronics is built on this one behaviour repeated enormously many times.
A mechanical switch gives the model, and its flaws explain why electronic switches won. A toggle switch or relay joins two metal contacts, and it is a nearly perfect switch in one respect: closed resistance is tiny and open resistance is effectively infinite. But contacts bounce, rapidly making and breaking for a few milliseconds when they meet, producing spurious pulses that digital circuits must filter; they wear and arc; they take milliseconds to operate; and they are big. A relay coil needs tens of milliamps and a clicking armature to move, which is why early computers built from relays, such as those of Konrad Zuse and Harvard's Mark I, were slow. Vacuum tubes switched in microseconds, as in ENIAC in 1945 with about 17,468 tubes, but burned heat and failed often.
A transistor is switched by driving it hard on or fully off, and the in-between region is deliberately avoided. In cutoff, the base-emitter junction is below roughly 0.5 volts in silicon, and the collector carries only a tiny leakage current. In saturation, enough base current is supplied that the base-collector junction also becomes forward-biased and the collector-emitter voltage falls to about 0.1 to 0.3 volts, so the transistor looks like a low-value closed contact. The power lost is the voltage across the transistor times the current: close to zero in either state, and largest during the transition, which is why switching edges should be fast and why switching losses rise with frequency. Because a transistor can supply gain, a single weak signal can drive many following switches, a property no passive contact offers.
CMOS pairs two complementary switches so that one is always off, and that is what makes modern chips possible. A CMOS inverter joins a p-channel transistor from the supply to the output and an n-channel transistor from the output to ground, with both gates tied to the input. A high input turns the n-channel device on and the p-channel device off, pulling the output low; a low input does the opposite. In either steady state one of the two is off, so almost no current flows from supply to ground, and power is consumed mainly while the output changes. Frank Wanlass of Fairchild filed a patent on the complementary arrangement in 1963, and CMOS later became the dominant logic technology, since it combines low idle power with full-voltage output levels. This is the pull-up and pull-down pairing that a pnp and npn pair performs in the bipolar world.
Scale and speed are what turn simple switches into computers. A chip such as a modern GPU contains on the order of tens of billions of transistors, each acting mainly as a switch, and flipping the on-off state many billions of times per second; the largest AI accelerators exceed 80 billion. A mid-1950s transistor switched in a fraction of a microsecond, while today's logic gates flip in picoseconds, with a gate delay of roughly ten to a few tens of picoseconds in advanced nodes. Each switching event charges or discharges a tiny capacitance, so the energy per operation is small, but the total across billions of devices produces tens to hundreds of watts of heat, which is why power and cooling limit chips more than the number of transistors. Memory cells, logic gates, power converters and LED drivers all use the same idea.
Real switches are not ideal, and misconceptions come from forgetting that. A transistor switch has a small resistance when on and a small leakage when off; the former wastes heat, and the latter, in modern nanometre processes, adds up to a large standby power. Switching an inductive load such as a relay coil or a motor generates a voltage spike when the current is cut, so a flyback diode is needed across the load to protect the transistor. The transistor also does not provide isolation like a mechanical contact, so mains-voltage loads are usually switched through relays or optically isolated devices. And many people mistake a transistor used as an amplifier for one used as a switch; the first uses the sloping middle of its characteristics, the second the two flat ends, so the same device is treated and biased differently.
Read the switch as the elementary choice between connected and disconnected: the transistor performs it electronically, with a small signal steering a large current, and billions of such choices per second, wired together, make up computation.