Capacitors are on almost every circuit board, often dozens of them. They store a small amount of electrical charge and release it quickly, which makes them useful for smoothing power, filtering noise and timing.
What a capacitor is
A capacitor is two conductive plates separated by an insulator, called the dielectric. Put a voltage across it and charge builds up on the plates. Remove the supply and the capacitor can hand that charge back.
A handy picture is a small water tank on a pipe. It fills up when pressure is available and tops up the flow when the supply dips. That's exactly what a capacitor does for a circuit's power.
Units
Capacitance is measured in farads (F), but one farad is huge, so you'll mostly see:
- µF (microfarads, millionths of a farad), common for electrolytic capacitors, from about 1 µF to thousands of µF.
- nF (nanofarads, 1,000 nF = 1 µF), common for ceramic capacitors.
- pF (picofarads, 1,000 pF = 1 nF), used in radio and timing circuits.
The main types
| Type | Typical values | Polarised? | Used for |
|---|---|---|---|
| Ceramic | 1 pF to about 100 µF | No | Decoupling, filtering, timing |
| Aluminium electrolytic | About 0.1 µF to thousands of µF | Yes | Bulk storage, smoothing power supplies |
| Tantalum | About 0.1 µF to hundreds of µF | Yes | Compact bulk storage |
| Film | About 1 nF to tens of µF | No | Audio, precise timing, mains filtering |
Polarity: getting it the right way round
Electrolytic and tantalum capacitors are polarised. Connected backwards they can overheat, bulge or even burst.
- Electrolytic: a stripe down the side, often with minus signs, marks the negative leg. The longer leg is positive.
- Tantalum: the stripe or mark usually indicates the positive side, the opposite of electrolytics, so check the datasheet.
Ceramic and film capacitors can go either way round.
Voltage rating
Every capacitor has a maximum voltage. Choose one rated comfortably above the highest voltage it will see. Going 50% to 100% above is a common rule of thumb, for example a 16 V capacitor on a 5 V or 9 V rail.
Reading ceramic capacitor codes
Small ceramic capacitors carry a three-digit code in picofarads, read like a resistor code: two digits, then the number of zeros.
104= 10 followed by 4 zeros = 100,000 pF = 100 nF (0.1 µF), the most common capacitor of all.103= 10,000 pF = 10 nF.222= 2,200 pF = 2.2 nF.- Two digits only, like
22, simply means 22 pF.
A letter after the number is often the tolerance: J is ±5%, K is ±10% and M is ±20%.
Decoupling capacitors
When a chip switches, it draws sudden bursts of current. The long wires back to the power supply can't respond fast enough, so the voltage at the chip dips briefly, which can cause glitches and resets. A decoupling capacitor, usually 100 nF ceramic, placed as close as possible to the chip's power pins, supplies those bursts locally.
That's why datasheets almost always ask for a 100 nF capacitor between each power pin and ground. A larger electrolytic capacitor (say 10 to 100 µF) where power enters the board helps with slower dips.
Capacitors and time
A capacitor charging through a resistor fills up at a predictable rate. The time constant, R × C, is the time to reach about 63% of the supply voltage:
τ = R × C
With 10 kΩ and 100 µF, τ = 10,000 × 0.0001 = 1 second. After about five time constants the capacitor is essentially full. This simple idea is behind timers, filters and button debouncing.
Going deeper
Energy, reactance and filters
A capacitor stores energy E = ½CV². A capacitor's opposition to AC, its reactance, falls as frequency rises: XC = 1 / (2πfC). That's why capacitors pass fast signals and block DC, and why a resistor and capacitor make a simple filter with a cut-off frequency of f = 1 / (2πRC):
import math
def rc_cutoff(r_ohms, c_farads):
return 1 / (2 * math.pi * r_ohms * c_farads)
def reactance(f_hz, c_farads):
return 1 / (2 * math.pi * f_hz * c_farads)
print(f"10k + 100nF low-pass cut-off: {rc_cutoff(10_000, 100e-9):.0f} Hz")
print(f"100nF at 50 Hz: {reactance(50, 100e-9)/1000:.1f} kOhm, at 1 MHz: {reactance(1e6, 100e-9):.2f} Ohm")
10k + 100nF low-pass cut-off: 159 Hz
100nF at 50 Hz: 31.8 kOhm, at 1 MHz: 1.59 Ohm
Real capacitors aren't ideal
- ESR (equivalent series resistance) causes heating with ripple current and limits how well a capacitor smooths power. Switching regulators often specify a maximum or minimum ESR for their output capacitor, so follow the datasheet.
- ESL (equivalent series inductance) means every capacitor stops acting like a capacitor above its self-resonant frequency. That's one reason boards use several values in parallel: a small, close capacitor for high frequencies and a larger one for slower changes.
- Leakage lets charge slowly drain away, which is highest in electrolytics.
Ceramic dielectrics and DC bias
Ceramic capacitors are graded by dielectric:
- C0G (also called NP0) is very stable with temperature and voltage. It's used for timing and filters, but only comes in small values.
- X7R and X5R change by up to ±15% across their temperature range (−55 to 125 °C for X7R, −55 to 85 °C for X5R). They're the general-purpose choice.
- Y5V can lose most of its capacitance at temperature extremes.
High-value X5R and X7R parts also lose capacitance when a DC voltage is applied. A small 10 µF capacitor on a voltage close to its rating can deliver only a fraction of its marked value. Manufacturers publish DC-bias curves: check them, or choose a higher voltage rating or larger case size.
Lifetime of electrolytics
Aluminium electrolytic capacitors dry out over time, and heat speeds this up. A widely used rule of thumb is that life roughly doubles for every 10 °C cooler the capacitor runs. A part rated 2,000 hours at 105 °C may last many years at 45 °C. Keep electrolytics away from heatsinks and regulators.
Sources
The main references behind this guide. Numbers we worked out ourselves, such as the code outputs, come from running the code.