PWM Frequency Calculator

Calculate the PWM frequency a microcontroller timer produces from its clock, prescaler and TOP value, in fast or phase-correct mode, with the duty-cycle resolution in bits.

Calculator Electronics Updated Oct 15, 2026
How to Use
  1. Enter the timer clock (often the CPU clock, such as 16MHz).
  2. Enter the prescaler (1, 8, 64, 256 or 1024 on AVR) and the TOP value the counter runs up to (255 for 8-bit).
  3. Pick fast PWM (single slope) or phase-correct PWM (dual slope, half the frequency).
  4. Read the PWM frequency, the period, the tick time and the duty-cycle resolution in bits.
Input
Presets
Timer Counter
fpwm
—
Period
—
Resolution
—
Tick
—

Worked Example

An Arduino Uno's timer runs from 16 MHz with prescaler 64 and TOP = 255. In fast PWM, f = 16,000,000 ÷ (64 × 256) = 976.6 Hz; in phase-correct PWM, f = 16,000,000 ÷ (64 × 2 × 255) = 490.2 Hz. Both give 8-bit resolution: 256 duty-cycle steps.

For a quiet motor set the prescaler to 1 and TOP to 799: 16 MHz ÷ 800 = 20 kHz, with about 9.6 bits (800 steps) of resolution.

The common mistake: forgetting the "+1". A counter running 0 to 255 has 256 states, so the divider is TOP + 1. In phase-correct mode the count goes up and back down, doubling the period.

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

Programmable counter-timer chips of the 1970s and early 1980s, such as Intel's 8253 and 8254, made "count to a set value, then reset" a standard building block, and microcontrollers later folded the same idea into on-chip timers with compare outputs. Atmel's AVR family offered both fast PWM (single-slope, counting 0 to TOP) and phase-correct PWM (dual-slope, 0 to TOP and back). Arduino's defaults on its ATmega boards (16 MHz clock, prescaler 64, TOP 255) give the familiar 976 Hz and 490 Hz analogWrite frequencies.

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

What are the formulas?

Fast PWM: f = fclk ÷ (prescaler × (TOP + 1)). Phase-correct PWM counts up and back down, so f = fclk ÷ (prescaler × 2 × TOP). These are the AVR datasheet formulas; other microcontrollers use the same idea with slightly different counting.

How do resolution and frequency trade off?

The duty cycle can only change in steps of one count, so the resolution is about log₂(TOP + 1) bits. A bigger TOP gives finer steps but a lower frequency; at 16 MHz with no prescaler, 8-bit PWM reaches 62.5 kHz but 10-bit only 15.6 kHz.

What frequency should I use for LEDs?

At least a few hundred hertz to avoid visible flicker, and preferably above 1–2 kHz to avoid flicker in cameras and for sensitive people; IEEE 1789 puts no limit above 1,250 Hz.

And for motors?

Around 16–25 kHz moves the switching whine above hearing. Lower frequencies give lower switching losses but are audible; very high ones heat the driver.

Why phase-correct for motors?

Its symmetric up-down count keeps the centre of each pulse fixed, which suits multi-phase motor drives and reduces some harmonics, at the cost of half the frequency for the same TOP.

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

Arduino analogWrite

Explains why some Uno pins run at 976 Hz and others at 490 Hz, and how to change the prescaler to move them.

Quiet Motor Control

Pick a prescaler and TOP that put the PWM above 20 kHz while keeping enough resolution for smooth speed control.

Servo Signals

A 50 Hz servo frame needs a large TOP: 16 MHz ÷ 8 with TOP 39,999 gives exactly 50 Hz with 0.5 µs steps.

LED Dimming

Choose a frequency high enough to avoid flicker and enough bits for smooth fades at low brightness.

Last updated: