PWM Frequency Calculator

PWM frequency from MCU clock, prescaler, and timer top value.

Calculator Electronics Updated Apr 18, 2026
How to Use
  1. Enter clock, prescaler, and timer top.
  2. fpwm = fclk / (prescaler · (top+1)).
Input
Presets
Timer Counter
fpwm
Period
Resolution
Tick

Show Work

Enter values.

Formulas

Fast PWM
fclk / (N · (top+1))
Single-slope.
Phase-correct
fclk / (N · 2 · top)
Dual-slope.
Resolution
log₂(top+1)
Bits.
Tick
N / fclk
Timer clock period.
Arduino UNO
16 MHz, pre 64, top 255 → 976 Hz
Default.
AVR prescalers
1, 8, 32, 64, 256, 1024
Varies by timer.

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.

Frequently Asked Questions

Top = 255?

8-bit timer, counts 0–255.

Resolution vs freq?

Higher top → more resolution but lower fpwm.

Common Use Cases

LED Dim

≥ 200 Hz avoids flicker.

Motor

16–25 kHz (inaudible).

Last updated: