Oscillator and Crystal Load Capacitor Calculator
Pick the right capacitors for a microcontroller crystal and work out what frequency a classic oscillator circuit or PLL will produce.
Runs in your browser. Your files never leave your device. See how to check
…
How to do it
- 1Choose the circuit
Crystal, RC, LC, 555 or PLL.
- 2Enter the values
With units.
- 3Read the frequency
Or the capacitor values.
- 4Check standard values
Nearest E12 for crystals.
- 5Note the requirements
Gain and duty cycle.
- 6Verify on the bench
Measure the real frequency.
About this tool
Almost every digital circuit needs a clock, and many analogue circuits need a stable sine wave. The most common practical question is the simplest: which capacitors go on either side of a microcontroller's crystal? Crystal datasheets give a load capacitance, CL, such as 12 or 18 pF, and the two capacitors in series plus the board's stray capacitance must equal it. Get it wrong and the clock runs fast or slow by tens of parts per million, enough to break USB, UART timing or a real-time clock. This calculator solves that, rounds to the nearest standard E12 value and shows the resulting load. It also gives the oscillation frequency of the classic circuits taught in electronics courses and still used in practice: the Wien bridge and three-section RC phase-shift oscillators with the amplifier gain they need, the LC Colpitts and Hartley oscillators, and the 555 timer in astable mode with its high time, low time and duty cycle. A PLL mode multiplies and divides a reference frequency and shows how its ppm error carries through to the output.
Crystal load capacitors
For a Pierce oscillator, the crystal sees C1 and C2 in series plus stray capacitance: CL = C1·C2 / (C1 + C2) + Cstray. With equal capacitors, C1 = C2 = 2 × (CL − Cstray). Stray capacitance from pins and traces is usually 2 to 5 pF. Many modern microcontrollers include adjustable internal load capacitors; check the datasheet before adding external ones.
Formulas
- Wien bridge: f = 1 / (2πRC), amplifier gain 3. - RC phase shift, three equal sections: f = 1 / (2πRC√6), gain 29. - Colpitts: f = 1 / (2π√(L·Ceq)) with Ceq = C1·C2 / (C1 + C2). - Hartley: f = 1 / (2π√((L1 + L2 + 2M)·C)). - 555 astable: f = 1.44 / ((R1 + 2R2)·C), high time 0.693 (R1 + R2) C, low time 0.693 R2 C. - PLL: fout = fref × N / (M × P).
Frequency accuracy
A crystal's frequency tolerance and temperature stability, typically 10 to 50 ppm, pass straight through a PLL. A 25 MHz reference at 20 ppm gives a 600 MHz output that may be off by 12 kHz. Use a temperature-compensated oscillator (TCXO) when accuracy matters.
Starting reliably
Oscillators need loop gain above one to start. Check the crystal's maximum drive level and the oscillator's negative resistance margin, which should be at least five times the crystal's ESR.
Limits
Formulas assume ideal components and amplifiers and are not a substitute for the crystal maker's official recommendations. Parasitic capacitance, component tolerances and temperature shift real frequencies; RC oscillators are typically accurate to a few percent, crystals to parts per million.
Worked example
A crystal with CL = 18 pF and 4 pF of stray capacitance needs C1 = C2 = 28 pF, so standard 27 pF capacitors give a load of 17.5 pF; a 555 with R1 = 1 kΩ, R2 = 10 kΩ and C = 10 nF runs at about 6.9 kHz with a 52% duty cycle.
Quick facts
- Category: Engineering & Construction
- Works in your browser, no sign-up, no upload.
- Your input stays on your device.
- Available in English.
- Content last reviewed:
- Official source: Microchip AN826 Crystal Oscillator Basics and PIC Oscillator Design
Frequently asked questions
How do I choose crystal capacitors?
C1 = C2 = 2 × (CL − stray capacitance), then round to a standard value.
What happens if the load is wrong?
The frequency shifts by a few ppm per pF, and the oscillator may not start.
Why can't a basic 555 go below 50% duty?
The high time includes R1 and R2; add a diode across R2 to change it.
What gain does a Wien bridge need?
Exactly 3, with automatic gain control for low distortion.
Does a PLL improve accuracy?
No. It keeps the reference's ppm error.
Is anything uploaded?
No. Calculations run in your browser.
