PWM Frequency Calculator
PWM frequency from MCU clock, prescaler, and timer top value.
How to Use
- Enter clock, prescaler, and timer top.
- fpwm = fclk / (prescaler · (top+1)).
Show Work
Formulas
History of MCU PWM Timers
The Intel 8254 programmable interval timer (1981) introduced the "count to TOP then reset" pattern that every MCU PWM timer since has mimicked. Atmel's AVR family added dedicated PWM modes in 1996 — fast PWM (single-slope, counts 0 to TOP) and phase-correct PWM (dual-slope, counts 0 to TOP to 0). The ATmega8 (1999), which became the Arduino UNO's AVR, established the defaults still used today: 16 MHz clock, prescaler 64, TOP 255 → 976 Hz default PWM frequency on analogWrite pins.
Phase-correct PWM matters for motor drives: the symmetric dual-slope count keeps the duty-cycle center synchronized across multiple channels, reducing harmonic spectrum and dead-band asymmetry when driving three-phase inverters. The trade-off: phase-correct PWM runs at half the single-slope frequency for the same TOP value.
Modern 32-bit MCUs (STM32, NXP S32, TI C2000) have dedicated motor-control PWM units with hardware dead-time insertion, synchronized multi-channel complementary outputs, fault-input shutdown, and subharmonic edge positioning. The math is still fclk / (N · (TOP+1)) — the computational recipe hasn't changed, just the feature set.
About This Calculator
Enter MCU clock frequency, timer prescaler (N), TOP value (0 to 255 for 8-bit, 0 to 65535 for 16-bit), and PWM mode. The tool computes PWM frequency: fast PWM = fclk / (N · (TOP+1)); phase-correct PWM = fclk / (N · 2 · TOP). Resolution (bits) = log₂(TOP+1); higher TOP = finer steps but lower frequency.
Typical goals: LED dim ≥ 200 Hz (avoid visible flicker), motor control 16-25 kHz (above audible), switched-mode supplies 100-500 kHz (small passives). Given fclk = 16 MHz, reaching 20 kHz motor PWM with 8-bit resolution needs TOP=255 and prescaler=3 (not available on AVR — use N=1 and TOP=800 on a 16-bit timer instead). Everything runs client-side; no values leave your browser.
About the PWM Frequency Calculator
The PWM Frequency Calculator is a simple, free helper for electronics and circuit design that runs entirely on your own device. PWM frequency from MCU clock, prescaler, and timer top value.
How it works
Enter your figures and the result appears instantly, updating the moment you change anything. There is no submit button and nothing to wait for, so it is easy to try a few what-if numbers and compare the results. Just check each box holds the kind of value it expects.
Want the deeper story? The Knowledge Base explains the ideas behind the tools in more detail.
Frequently Asked Questions
Top = 255?
8-bit timer, counts 0–255.
Resolution vs freq?
Higher top → more resolution but lower fpwm.
How do I use the PWM Frequency Calculator?
Just type your numbers. The answer shows up right away — there is no button to press. Change anything and it updates by itself.
Does it cost anything or need an account?
No. The tool is completely free, there is no account to create, and it keeps working offline after the page first loads.
Is anything I type uploaded?
No. The tool works entirely on your device, so the values you enter never leave your browser.
Common Use Cases
LED Dim
≥ 200 Hz avoids flicker.
Motor
16–25 kHz (inaudible).
Last updated: