100nF

Crystal load capacitor calculator

A crystal is trimmed to run on-frequency into one specific load. The two capacitors on the MCU pins have to present that load, after the stray capacitance of the pins and traces is counted. Get it wrong and the oscillator still starts — just off frequency, and your RTC drifts.

XTALC1 22 pFC2 22 pFCs 3.0Cs 3.0
Fig 1 — Pierce oscillator; the crystal sees C_L = 12.5 pF.
C1 = C2, exact
22.0 pF
Nearest E12 value
22 pF
Load seen with 22 pF
12.50 pF (-0.00 pF)

How this is calculated

Standard: TI SWRA372 (AN-100) Section 4, Eq. 1 — load capacitance; ST AN2867 Sections 3.3–3.5 — gain margin and drive level

CL=(C1+Cs)⋅(C2+Cs)C1+C2+2⋅CsC_L = \frac{(C_1 + C_s) \cdot (C_2 + C_s)}{C_1 + C_2 + 2 \cdot C_s}
SWRA372’s per-side convention: C_s is counted once on each leg. Documents that lump the stray into a single term (AN2867 among them) solve to C1 = 2·(C_L − C_s) instead — same physics, different definition of C_s.
C1=C2=2⋅CL−CsC_1 = C_2 = 2 \cdot C_L - C_s
Symmetric pair, per-side stray.
dfdCL=−f⋅Cm2⋅(C0+CL)2\frac{df}{dC_L} = \frac{-f \cdot C_m}{2 \cdot (C_0 + C_L)^2}
Frequency pulling at C_L.
gmcrit=4⋅ESR⋅(2πf)2⋅(C0+CL)2\text{gm}_{crit} = 4 \cdot \text{ESR} \cdot (2\pi f)^2 \cdot (C_0 + C_L)^2
Gain margin is gm divided by gm_crit, and it needs to be greater than 5.
DL=ESR⋅(π⋅f⋅(C0+CL)⋅Vpp)22\text{DL} = \frac{\text{ESR} \cdot \bigl(\pi \cdot f \cdot (C_0 + C_L) \cdot V_{pp}\bigr)^2}{2}
Drive level.

Assumptions

What sets a crystal's load capacitors

A crystal is trimmed at the factory to sit on its nominal frequency when it sees one specific capacitance across its terminals: the rated load CL, printed on the datasheet as 8, 9, 12.5, 18 or 20 pF. In a Pierce oscillator the crystal sees the two pin capacitors in series, and on each side the pin, pad and trace stray capacitance sits in parallel with the capacitor you fitted. That load, and the equal-capacitor case solved for the part to fit, are the first two expressions under How this is calculated above.

Cs is the stray per side. The MCU datasheet gives the pin capacitance (2 to 4 pF is normal); a short trace and its pad add another 1 to 2 pF. This per-side form is Equation 1 of TI SWRA372, section 4, and it is a convention worth noticing: ST AN2867, Oscillator design guide for STM8 and STM32 instead lumps the whole stray into one term, which solves to C1 = 2·(CL − Cs) — a full E12 step lower for the same numbers. Neither is wrong; they define Cs differently. The calculator follows SWRA372's per-side definition, rounds C to the nearest E12 value and then reports the load you actually get with that part.

Two more checks from AN2867 decide whether the oscillator starts at all, and the tool runs both when you supply ESR, C0 and the MCU's transconductance. Gain margin (§3.3) is the critical transconductance expression above, with the margin being gm divided by it. Drive level (§3.5) is the last expression, whose bracketed term is the peak current π·f·(C0+CL)·Vpp through the crystal; compare the result against the part's rated drive, typically 100 µW for an MHz-class crystal and 0.5 to 1 µW for a tuning fork.

Frequency pulling is the last output. With Cm and C0 from the crystal datasheet, the slope of frequency against load at the rated CL is the pulling expression above. It is in hertz per farad; the tool reports the more usable Hz/pF.

Crystal load capacitor chart

Each external capacitor for the load capacitances crystals are actually sold with, computed by the calculator above for a symmetric pair: C1 = C2 = 2·CL − Cstray, then the E12 value nearest it, and the load that real part presents once the stray is added back. The stray is per side, the MCU pin plus its pad and trace, and the two columns bracket the range it usually falls in.

CLExact, 3 pF strayE12 partLoad it givesExact, 5 pF strayE12 partLoad it gives
8 pF13 pF12 pF7.5 pF11 pF12 pF8.5 pF
9 pF15 pF15 pF9 pF13 pF12 pF8.5 pF
10 pF17 pF18 pF10.5 pF15 pF15 pF10 pF
12 pF21 pF22 pF12.5 pF19 pF18 pF11.5 pF
12.5 pF22 pF22 pF12.5 pF20 pF22 pF13.5 pF
15 pF27 pF27 pF15 pF25 pF27 pF16 pF
18 pF33 pF33 pF18 pF31 pF33 pF19 pF
20 pF37 pF39 pF21 pF35 pF33 pF19 pF
22 pF41 pF39 pF21 pF39 pF39 pF22 pF

The chart is why the stray matters more than the datasheet suggests: at the 8 pF and 9 pF loads that low-power parts specify, 2 pF of extra stray is a fifth of the external capacitor, and the E12 grid is coarse enough at those values that the rounding alone can move the load by half a picofarad or more.

Worked example: an 8 MHz crystal with a 10 pF load

8 MHz crystal, CL = 10 pF, ESR 80 Ω, C0 = 5 pF, Cm = 20 fF. Stray per side estimated at 3 pF. MCU HSE transconductance 25 mA/V.

C  = 2 × 10 − 3 = 17 pF          nearest E12: 18 pF (15 is further)

Load with 18 pF:
  C_L' = (18 + 3) / 2 = 10.5 pF          error +0.5 pF

Pulling slope:
  df/dC = 8e6 × 20e-15 / (2 × (5e-12 + 10e-12)²)
        = 1.6e-7 / (2 × 2.25e-22)
        = 3.56e14 Hz/F  =  356 Hz/pF
  Δf    = 356 × 0.5 = 178 Hz  →  178 / 8e6 = 22 ppm

Gain margin:
  (2π × 8e6)²        = 2.527e15
  (C0 + C_L)²        = (15e-12)² = 2.25e-22
  gm_crit = 4 × 80 × 2.527e15 × 2.25e-22 = 1.82e-4 A/V = 0.182 mA/V
  margin  = 25 / 0.182 = 137                    (> 5, starts with room to spare)

Drive level, 1.0 V pk-pk measured at the crystal:
  I_pk = π × 8e6 × 15e-12 × 1.0 = 377 µA
  DL   = 80 × (377e-6)² / 2    = 5.7 µW          (rated 100 µW, fine)

The calculator reports 17.0 pF exact, 18 pF E12, 10.50 pF seen, +0.50 pF error, 356 Hz/pF and 22.2 ppm. The extra half picofarad of load pulls the crystal 22 ppm below nominal, which is already the whole tolerance budget on many parts. 15 pF would land at 9.0 pF and −1.0 pF the other way; fitting one 15 and one 18 gets within 0.25 pF, and that is the one case where an asymmetric pair earns its keep.

Where the load capacitance model stops being valid

32.768 kHz is a different animal. The formulas are the same; the numbers are not. A tuning-fork crystal has an ESR of 35 to 90 kΩ, a C0 around 1.3 pF and a drive rating of 0.5 to 1 µW. Run the gain-margin check on a 70 kΩ, 12.5 pF part and gmcrit comes out around 2.3 µA/V. A low-power LSE driver offers only a few µA/V, so the same MCU that has a margin of 137 on its HSE can be at 2 on its LSE and fail to start cold. Drop to a 6 or 7 pF crystal, or turn the driver strength up one step and accept the extra hundred nanoamps. Conversely a driver set too strong overdrives the fork and ages it; the frequency walks.

Why RTC crystals drift anyway. A tuning fork's temperature curve is a parabola centred at 25 °C, about −0.035 ppm/°C². At 0 °C it is 22 ppm low; at −20 °C, 71 ppm, which is six seconds a day. No load capacitor fixes that; you need temperature compensation in firmware or a TCXO. The load error on top of it is what this tool controls, and at 32 kHz the sensitivity is worse because C0 is so small: the same 0.5 pF error is typically 15 to 25 ppm. Thecrystal ppm calculator adds that parabola, the initial tolerance and ageing together into a total drift budget.

The gain-margin formula is conservative. AN2867 derives it for the crystal's own C0 plus CL; a probe on the pin adds its own capacitance to both the load and the drive calculation, so measure Vpp with a sub-1 pF active probe or accept that the measurement itself moves the number. Margins between 3 and 5 often start fine on the bench and fail at −40 °C or on a part from a different lot. Any series Rext on the driver output adds to ESR.Why the crystal won't start walks through the rest of the failure modes, in the order worth checking them.

Measuring the stray instead of guessing. Fit the calculated capacitors, run the oscillator, and read the frequency on a counter through a buffered output (MCO pin, not a probe on the crystal). Convert the error back to capacitance with the pulling slope. In the example, 356 Hz/pF is 44 ppm/pF, so a measured −20 ppm means the crystal sees 0.45 pF more load than assumed, which is 0.9 pF more stray per side since CL = (C + Cs)/2. Rerun the tool with Cs = 3.9 pF and pick again. One iteration is enough.

Common crystal load capacitor mistakes

Further reading