How Transistors Work: From Semiconductors to MOSFETs
A deep dive into the world of transistors. Learn about semiconductor physics, P-type vs N-type doping, and how MOSFETs function as the building blocks of CPUs.
In this chapter, we will uncover the details of the tiny switch at the heart of modern computing: the transistor. We start with an introduction to electricity, then dive into the details of the transistor. We finish with a brief history lesson.
Electricity Basics
Before we begin with transistors, here is a quick introduction to electricity concepts: voltage, current, and binary states. Feel free to skip this section if you are already familiar with them. In electricity, voltage is the pressure from a power source that pushes electric charges through the circuit. You can see it as a water hose; the higher the pressure, the harder the water wants to flow. Current is the flow or movement of electric charge. More current means more charges are moving through the wire per second, like the flow of water through a hose. Binary states are fairly simple. There are two states:
- Off, no current or below a threshold.
- On, current is flowing or above a threshold.
What Exactly Is a Transistor?
Let’s begin with a question, the answer to which is simple, but the specifics can become quite complicated: What is a transistor? At its core, a transistor is an electronic switch that regulates the flow of electrical current. When the switch is on, it represents a 1. When it’s off, it represents a 0. This simple on/off behaviour is the foundation on which digital computing is built. Everything inside your computer, like images, sounds, and programs, can be reduced to tiny switches flipping between 0 and 1. They are essentially little bits of electric current. You may be asking whether this is the origin of the word “bits” in the context of digital computing. No, don’t get confused; the abbreviation “bits” stands for “binary digits.”
Semiconductors
Unlike the light switch on your wall, a transistor is microscopic, has no moving parts, and requires no human hand to operate. This is made possible by the physics of semiconductors. A semiconductor is a material whose electrical conductivity lies between that of an insulator and a conductor. To put it more simply, it conducts electricity better than something like plastic, but not as well as metals like copper. Silicon is one of these semiconducting materials, and the most important in modern electronics. Fun fact: about 28% of Earth’s crust is silicon, so we’re not running out anytime soon. Silicon atoms have four outer (valence) electrons, allowing each atom to bond with four neighbours in a rigid, tetrahedral crystal structure. In pure silicon, nearly all electrons are locked in these bonds, so only a small fraction gains enough energy to move freely through the lattice. This limited number of mobile charges is what makes silicon a semiconductor. On its own, pure silicon isn’t useful for building a transistor. Luckily for us, there is a process called doping. In doping, a small amount of impurity atoms (atoms of a different element) is injected, changing the electrical behaviour. There are two types of doping, N and P-type:
- N-type doping: Atoms with three valence electrons (e.g. boron) are added. This creates “holes”, electron vacancies that behave like positive charge carriers.
- P-type doping: Atoms with five valence electrons (e.g. phosphorus) are added. The extra electron becomes free to move, creating an excess of negative charge carriers.
Together, N-type and P-type semiconductors form the foundation of transistors, and by combining them, we can create devices like the MOSFET, the tiny transistor at the heart of modern computing.
![]()
Meet the MOSFET’s three players
A common type of transistor used in digital circuits is the MOSFET (Metal-Oxide-Semiconductor Field-Effect Transistor). It has three electrical contacts:
- Source (where current enters)
- Drain (where the current exits)
- Gate (which controls the flow)
The gate is separated from the semiconductor by a thin oxide layer, allowing it to control current without direct contact. At rest, electrons from the N-type regions naturally diffuse into the P-type region, filling holes and creating a depletion region. In this region, mobile charges are absent, forming a barrier that blocks current flow. This is the off state of the transistor. When a small positive voltage is applied to the gate, it attracts electrons toward the channel. This reduces the depletion region, allowing current to pass freely from source to drain. This is the on state, where the transistor acts as a closed switch. You can think of the gate like a drawbridge: when it’s up, nothing can cross (off state). When it’s lowered with a voltage, it creates a path across the channel, letting current flow (on state). However, the MOSFET wasn’t always there.
If you like a more visual explanation, I highly recommend watching this YouTube video by Veritasium

In The Beginning
It is hard to imagine, but before transistors were a thing, early computers relied on vacuum tubes. Glass tubes which looked a lot like light bulbs. As the name suggests, it uses vacuums to control the flow of electrical current. The vacuum inside the tube removes all materials, even air, that could conduct electricity. The story begins on 16 November 1904, when British electrical engineer and physicist Sir John Ambrose Fleming patented the first vacuum tube. By 1939, they were being demonstrated for computation, and in 1946, the famous ENIAC computer was built with more than 17,000 tubes. It was ground-breaking, but also fragile. Vacuum tubes often burned out, and when one failed, it could take 15 minutes to locate and two days to replace. Not ideal if you ask me. On the upside, it made electronic computing possible for the first time in history. The next leap came in 1947, when John Bardeen, Walter Brattain, and William Shockley at AT&T’s Bell Labs invented the first working transistor. Smaller, faster, and more reliable than vacuum tubes. Then, between 1955 and 1960, Bell Labs revolutionised and invented the MOSFET. This design became the backbone of microchips, and it still powers every smartphone, laptop, and server in use today.