Crystal Load Capacitor Calculator (C1/C2 from CL & Stray, Drive Level, Gain Margin, Frequency Pull)
Choose the two external capacitors for a Pierce crystal oscillator from the crystal's specified load capacitance and the board's stray capacitance, then check drive level against the crystal's maximum, the oscillator gain margin from ESR and shunt capacitance, the frequency pull per picofarad, and when to add a series resistor.
How it works
CL = (C1 × C2) ÷ (C1 + C2) + Cs → for C1 = C2: C = 2 × (CL − Cs) · drive level DL = I_rms² × ESR, I_rms ≈ 2πf × (CL + C0) × V_pp ÷ 2√2 · gm_crit = 4 × ESR × (2πf)² × (C0 + CL)²; margin = gm ÷ gm_crit ≥ 5 · pull ≈ C_m ÷ [2 (C0 + CL)²] per pF (C_m ≈ 20 fF AT-cut, 3 fF tuning fork)
A crystal is cut to run at its nominal frequency with a specific capacitance across it — the load capacitance — which in a Pierce oscillator is formed by the two capacitors to ground in series, plus the stray capacitance of the pins and traces. Getting that right sets the frequency; the other two checks decide whether the oscillator starts and whether the crystal survives: the oscillator's gain must exceed the crystal's losses by a comfortable margin, and the current through the crystal must not exceed its drive-level rating, especially for tiny SMD crystals and 32 kHz tuning forks. The calculator gives the capacitor values, the drive and margin, and how sensitive the frequency is to a picofarad of error.
Worked example
A 16 MHz crystal specified for an 18 pF load with about 3 pF of stray per pin needs C1 = C2 = 2 × (18 − 3) = 30 pF; the standard 33 pF gives (33 + 3) ÷ 2 = 18.0 pF exactly, so no frequency offset — 27 pF would sit 3 pF low and run about 57 ppm high at roughly 19 ppm per pF. At 2.5 Vpp the drive is about 250 µW through 60 Ω, under a 500 µW HC-49 limit (a small SMD crystal rated 100 µW would need a series resistor); the critical gm is 1.3 mA/V, so an MCU oscillator with 10 mA/V has a 7.8× margin.
Frequently asked questions
What happens if the load capacitors are wrong?
Too little capacitance pulls the frequency high, too much pulls it low — a few pF is tens of ppm at MHz (and hundreds at 32 kHz), which can matter for USB, RF and timekeeping. Far too much capacitance also starves the oscillator of gain and it may not start.
Do I need the series resistor?
Only when the drive level exceeds the crystal's rating, which is common with small SMD crystals (100–200 µW limits) and 32 kHz tuning forks (1 µW) on strong oscillator drivers. Size it so the amplitude drops just enough; too large a resistor kills the gain margin.
How do I measure stray capacitance?
Fit the calculated capacitors, measure the frequency error in ppm on a divided clock output, and use the pull figure (ppm per pF) to work back to the load error — half of it is the per-pin stray you missed. Adjust C1/C2 by that amount and re-measure; document the result for that board layout.
Related calculators
Electronics estimates use simplified models and typical component values. Check the datasheet limits (voltage, current, temperature, gate charge, ESR), prototype, and measure — especially for anything connected to mains, batteries or motors. Motional capacitance, stray values and transconductance vary by part; confirm with the crystal and MCU datasheets and a measurement.