OctaCalc / PWM Duty Cycle Calculator

PWM Duty Cycle Calculator

Calculate PWM period, on-time, and off-time from a frequency and duty cycle percentage. Results update live as you type.

How to Use This Calculator

Enter the PWM frequency in Hz (e.g. 1000 for 1 kHz, 20000 for 20 kHz), the duty cycle as a percentage (0–100), and your supply voltage. The period, on-time, off-time, average voltage, and waveform preview all update instantly. A duty cycle of 50% means the signal is high for exactly half of each period.

Formula

T = 1 / f
T_on = (Duty / 100) × T
T_off = T − T_on

T = period (s), f = frequency (Hz), Duty = duty cycle (%), T_on = high time, T_off = low time.

Example

Scenario: 20 kHz PWM at 75% duty cycle (common for motor control)
T = 1 / 20,000 = 50 µs
T_on = 0.75 × 50 = 37.5 µs
T_off = 50 − 37.5 = 12.5 µs

Frequently Asked Questions

What does duty cycle mean?
Duty cycle is the percentage of one period during which the signal is in the HIGH (on) state. A 25% duty cycle means the signal is high for a quarter of each cycle and low for the remaining three quarters.

How is PWM used to control motor speed?
By varying the duty cycle, you vary the average voltage delivered to the motor. A 50% duty cycle on a 12V supply delivers an average of 6V, making the motor run at roughly half speed without wasting energy as heat (unlike a resistor).

What frequency should I use for PWM?
It depends on the application. LED dimming is typically 200 Hz–2 kHz (above flicker threshold). DC motors commonly use 1–20 kHz. Audio and servo applications have their own requirements. Higher frequency generally reduces ripple but increases switching losses.

What is the relationship between duty cycle and average voltage?
Average voltage = Supply × (Duty% / 100). This is the effective DC voltage that a low-pass-filtered PWM signal approximates.