Pulse Width Modulation (PWM) is the technique of switching a signal rapidly between fully ON and fully OFF to control the effective power delivered to a load. By varying the fraction of time the signal stays high — the duty cycle — you can dim LEDs, set motor speeds, regulate DC-DC converters, synthesize audio, and control servos, all without the losses that a linear regulator would introduce.
This calculator handles all three common starting-point scenarios: you know the frequency and duty cycle (typical when programming a microcontroller), you know the on-time and off-time (typical when reading a datasheet or oscilloscope), or you know the on-time and total period (typical in timer-register calculations). Switch between the three tabs, enter your numbers, and every derived quantity updates instantly.
How it works
Every PWM result flows from two fundamental quantities: the period T (the duration of one complete cycle) and t-on (how long the signal is high within that cycle).
Duty cycle: D = t-on / T
Frequency: f = 1 / T
t-off: T - t-on
For electrical quantities on a resistive load driven by a square wave switching between 0 and Vpeak:
- Average voltage: Vavg = D * Vpeak
- RMS voltage: Vrms = sqrt(D) * Vpeak
- Average current: Iavg = D * Ipeak
- RMS current: Irms = sqrt(D) * Ipeak
- Average (and RMS) power: P = D * Vpeak * Ipeak
The distinction between average and RMS matters: average voltage is what a smoothing capacitor charges to; RMS voltage is what determines heat dissipation in a resistive element. For a pure square wave, average power and RMS power are identical for a resistive load — both equal D * Vpeak * Ipeak.
Worked example — Arduino LED dimming at 25%
An Arduino runs PWM at 980 Hz with a duty cycle of 25%. The LED forward voltage is 3.3 V and the series resistor limits peak current to 20 mA.
- Period: T = 1 / 980 = 1020.4 µs
- t-on: 0.25 * 1020.4 = 255.1 µs
- t-off: 0.75 * 1020.4 = 765.3 µs
- Average voltage across load: 0.25 * 3.3 = 0.825 V (but the LED itself is non-linear — use this as a guide)
- Average current (resistive model): 0.25 * 20 mA = 5 mA
- Average power: 0.25 * 3.3 * 0.02 = 16.5 mW
Enter 980 Hz + 25% in the calculator above to verify instantly.
Formula reference
| Quantity | Formula |
|---|---|
| Duty cycle | D = t-on / T |
| Period | T = t-on + t-off |
| Frequency | f = 1 / T |
| t-on | D / f |
| t-off | (1 - D) / f |
| Avg voltage | D * Vpeak |
| RMS voltage | sqrt(D) * Vpeak |
| Avg power | D * Vpeak * Ipeak |
All calculations run entirely in your browser — no values are uploaded or stored anywhere.