Everything you can touch — copper wire, silicon chips, air, water, your own hand — is made of atoms. And every atom is made of just three kinds of particles.
Electron — tiny, negatively charged, orbits around the outside of the atom. Almost no mass. This is the particle that does all the work in electricity and electronics. Remember this one — every animation after this is really about electrons.
Proton — positively charged, sits in the nucleus at the center of the atom. The number of protons is what makes an element what it is: 1 proton = hydrogen, 29 = copper, 79 = gold. Change the proton count and you literally change what element you're looking at.
Neutron — no charge. Also sits in the nucleus alongside the protons. Adds mass and keeps the protons from flying apart from their mutual repulsion.
Positive and negative charges attract. Same charges repel. That single rule drives everything that follows.
Zoom out one level. In a normal atom, the protons and neutrons cluster in the nucleus. The electrons orbit around the nucleus in shells — like layers of an onion.
Inner shell electrons sit close to the nucleus and are held tightly — they're not going anywhere.
But the outer shell — called the valence shell — is loose. Those electrons are barely hanging on. Give them a little push and they'll hop right off to a neighboring atom.
This is the whole game. Materials that hold their valence electrons tight (rubber, glass, plastic) are insulators. Materials with loose, practically-free valence electrons (copper, silver, gold, aluminum) are conductors. Everything electrical exists on this spectrum.
From here on, when I say "electron," I mean a valence electron. The inner ones don't matter for our purposes.
Take a conductor — copper wire is the classic example. Now hook it up to a battery. The battery has two terminals: negative (−) and positive (+).
The negative terminal is packed with extra electrons. Because negative charges repel each other, they're pushing against each other trying to get out. The positive terminal is the opposite — it's short on electrons, so it pulls them in.
Give the electrons a path (the wire), and they flow. Negative terminal to positive terminal, through everything in between, until the pressure equalizes or the battery runs down.
That flow is what we call current. Every electrical device — light bulbs, motors, phones, computers — is just something you put in the middle of that flow to make it do useful work.
Textbook footnote: Old physics diagrams draw current going the opposite direction, positive to negative. That's a leftover from before we knew electrons were the ones actually moving. The physical reality is what you see here.
Here's where most people get tripped up. Electrons don't stream through the wire like water through a pipe. That's not what's happening.
What's actually happening: each electron only moves a tiny distance before it settles into the valence shell of the next atom over — and kicks THAT atom's outer electron off in the process. Then that displaced electron does the same thing to the atom next to it. And so on, down the wire.
It's a chain reaction of hops. The electron that arrives at the far end isn't the same one that started. They're being handed off, atom by atom.
The signal (the "current") travels close to the speed of light because the chain reaction propagates almost instantly. But any individual electron moves at a crawl.
Think of a stadium wave — the wave shoots around the stadium in seconds, but any one person just stands up and sits down.
Now that we've got flow, we need a way to talk about it. Three measurements describe any electrical circuit — and they're locked together by a single equation.
Voltage (V) — the pressure. How hard the electrons are being pushed. A 9-volt battery pushes with 9 volts of force. A wall outlet pushes with 120. Voltage is measured between two points — you can't have voltage at just one place.
Amperage (A) — the flow rate. How many electrons are passing a given point per second. More amps = more electrons per second.
Resistance (Ω, "ohms") — how much the material fights the flow. Copper wire has near-zero resistance (electrons pass easily). A heater coil has high resistance (electrons have to fight to get through). Glass has near-infinite resistance (nothing gets through).
They tie together as V = I × R — Ohm's law. Change any one and the others adjust. This equation is the entire foundation of practical electrical work: every wire gauge chart, every circuit breaker rating, every battery spec — it's all Ohm's law in different clothes.
Once you've got electrons moving through a circuit, you can turn that flow into four kinds of useful work. These four are the entire menu of what electricity is for.
Heat — force electrons through something with high resistance and the friction dissipates as heat. This is your space heater, your toaster, an old-school incandescent light bulb (a filament that got so hot it glowed), the burner on a kitchen stove. Ohm's law explains why: high R means the current has to fight, and that fight becomes thermal energy.
Light — in LEDs and other semiconductors, electrons drop energy levels and release the difference as photons. Every screen you look at is doing this — billions of tiny LEDs turning on and off.
Magnetism — any moving electric charge generates a magnetic field. Coil a wire around something, run current through it, and you have an electromagnet. That's how motors, speakers, generators, transformers, and the read head of a hard drive all work.
Control — this is the one that matters most for computers. A small amount of current can be used to gate a much larger amount. That's a transistor. That's how we get from raw electricity to logic and computation. The rest of this series is following that fourth branch.
To build an electronic switch, you need a material where you can decide, moment to moment, whether electrons can flow through it or not. Pure silicon almost works — but not quite.
Silicon has 4 valence electrons per atom. In a pure silicon crystal, every atom bonds neatly with 4 neighbors, and every electron is locked into a bond. No loose electrons to carry current, no empty spots to accept new ones. It just sits there — no carriers, no conduction.
Doping is the trick that fixes this. You deliberately mix in a tiny amount of a different element to create carriers on purpose.
N-type silicon — add phosphorus (5 valence electrons). Four bond into the silicon lattice; the fifth is left over, free to wander. You now have extra electrons that carry current. Negative carriers — that's where the N comes from.
P-type silicon — add boron (3 valence electrons). Now there's one missing bond — a hole. A neighboring electron can hop into that hole, which effectively moves the hole in the opposite direction. Holes act as positive carriers — that's the P.
Neither type is very useful on its own. But sandwich them together — N-P-N or P-N-P — and you've built a transistor.
Take a doped-silicon sandwich (NPN or PNP), attach three wires — input, output, and control — and you've built a switch with no moving parts.
Here's how it works: put voltage on the control pin and the middle layer's electric field lets carriers cross. Electrons flow freely from input to output. Take the voltage off the control pin and the field collapses — the path closes and current is blocked.
Before transistors, computers used mechanical switches called relays. Physical arms that flicked open and closed. Slow, huge, prone to failure, and drew a ton of power. The first digital computer (ENIAC, 1945) used 17,000 vacuum tubes and filled a room; it was constantly breaking down.
Transistors do the same job but they're solid-state — nothing physically moves. They switch billions of times per second and you can pack billions of them into a chip the size of a fingernail. A modern smartphone has more transistors than there are stars in the Milky Way.
Everything from here on is just lots and lots of transistors, arranged in patterns.
Because a transistor is a sandwich, there are two ways to stack the layers.
NPN conducts when the control pin is HIGH (voltage present, "1"). "Active high."
PNP conducts when the control pin is LOW (no voltage, "0"). "Active low."
They're mirror images of each other. Neither is "better" — they're complements.
Why does that matter? Because if you pair them up — one NPN and one PNP sharing the same control signal — exactly one of them is on at any given moment. Never both, never neither. That pairing is called CMOS (complementary metal-oxide semiconductor), and it's what every modern chip is built out of. Efficient, low-power, and it scales down to features just a few atoms wide.
The little arrow on the emitter (the bottom leg in each diagram) is how you tell them apart on a schematic — arrow pointing OUT of the transistor is NPN, arrow pointing IN is PNP. Not something you memorize, just something to recognize.
A transistor is either on (current flowing) or off (current blocked). Two states. That's it — no in-between.
We call each transistor's state a bit: a single 0 or 1. This is the fundamental unit of everything a computer does. Every photo, every video, every song, every AI model, every text message — all of it is millions or billions of transistors, each in one of two states.
One bit isn't much. But group 8 bits together and you get a byte. Each position in the byte represents a power of 2 — the values double as you move across: 1, 2, 4, 8, 16, 32, 64, 128. Turn on the bits you want, add up their place values, and you have a number.
The byte shown here — 10000010 reading left to right — has the 1-bit and the 64-bit turned on. 1 + 64 = 65. And in ASCII (the standard mapping of numbers to text characters), the number 65 represents the letter "A". Same byte, three different ways of reading it: bits, decimal number, character.
Convention note: This diagram reads smallest-value-first (left to right) because it's easier to teach that way. Standard binary notation is written the other way around — biggest value first — so 65 would normally appear as 01000001. Same byte, mirrored. Both are correct.
Same 8-bit byte, but now animated — counting from 1 up to 8. Only the first four bits change because we're not counting high enough to need the rest.
Notice the pattern: 1 = just the 1-bit. 2 = just the 2-bit. 3 = both the 1-bit AND the 2-bit (1 + 2 = 3). 4 = just the 4-bit. 5 = the 4-bit and the 1-bit (4 + 1 = 5). And so on.
Every whole number can be expressed as a specific combination of these place values turned on. That's binary — a number system that uses only 0s and 1s, perfect for a machine whose fundamental unit is on/off.
Bigger numbers just need more bits. 8 bits gets you 0 to 255. 16 bits gets you 0 to 65,535. 32 bits gets you into the billions. 64 bits — what most modern chips work with — gets you into numbers so large they're used to count grains of sand in the Sahara without breaking a sweat.
Now we're going to wire multiple transistors together to make circuits that take bits IN and produce a bit OUT — based on a rule. These are called logic gates. Six of them cover almost everything.
AND — outputs 1 only if BOTH inputs are 1. Like two switches wired in series — both have to be on for the current to reach the other side.
OR — outputs 1 if EITHER input is 1. Two switches wired in parallel — just one needs to be on.
NOT — takes one input, flips it. 1 becomes 0, 0 becomes 1.
NAND and NOR — inverted versions of AND and OR (that little circle on the output is the "not" bubble).
XOR ("exclusive or") — outputs 1 only when the inputs are DIFFERENT. Same inputs → 0. This one is subtle but incredibly useful.
Wild fact: NAND alone is enough to build every other gate. Same with NOR. They're called "universal gates" — with enough of just one type, you can construct any digital circuit that has ever existed. Most chip fabs actually build almost exclusively out of NAND-based CMOS pairs and derive everything else from combinations.
Now for the payoff. Wire two logic gates together — an XOR and an AND — and you can actually do arithmetic with bits.
Feed in two 1-bit inputs (A and B). You get two output bits (Sum and Carry):
XOR produces the Sum bit — outputs 1 when the inputs differ. Because in binary: 0+1 = 1 and 1+0 = 1, but 0+0 = 0 and 1+1 = 0 (with a carry to the next column).
AND produces the Carry bit — outputs 1 only when both inputs are 1. Because that's the only case where the addition overflows past a single bit.
Read the outputs together as a 2-bit binary number and you've literally done 1-bit addition. 1 + 1 = 10 in binary = 2 in decimal.
This is called a half-adder because it only handles one column of addition. A full adder adds a third "carry-in" input so you can chain them together — column-by-column, exactly like doing long addition on paper. Chain 8 full adders and you can add two bytes. Chain 64 of them and you have the integer adder inside a modern CPU.
From here, it's the whole computer. Adders go into the ALU (arithmetic logic unit). Latch a few thousand more gates together to build registers and memory. Add a clock and a control unit, and you're executing instructions. Every word doc, every video, every AI model — all of it eventually decomposes into voltages running through transistors arranged into gates. That's it. That's the whole magic trick.
One last piece — because reading raw binary is exhausting. Try scanning 11011010 01101001 10101010 at a glance without going cross-eyed. Nobody actually reads bytes this way.
The trick: 4 bits has exactly 16 possible values (0 through 15). And there's a numbering system with exactly 16 characters — hexadecimal, or hex. It uses 0 through 9, then A through F (for values 10 through 15). So 4 bits maps perfectly to one hex character. A whole byte (8 bits) fits in just 2 hex characters.
Split the byte down the middle. Upper 4 bits → first hex character. Lower 4 bits → second hex character. Prefix it with 0x to make it clear you're reading hex, not decimal.
You'll see hex all over the place once you know what to look for:
#FF0000 is red. That's three bytes: FF (255) red, 00 (0) green, 00 (0) blue. Every color on every screen is just three hex bytes.0x7FFE3A4C. Every location in your computer's RAM has one.'A' = 0x41. Same as decimal 65, same as binary 01000001. Three ways of writing the same byte.0xFFD8FF = JPEG. 0x89504E47 = PNG.And that's the whole stack. Voltage in a wire → electrons in a conductor → doped silicon → transistors → logic gates → binary → hex → programs → applications → the entire digital world. Every layer sits directly on top of the one below it, and none of it is magic.