PWM Duty Cycle Calculator
Pulse-width modulation (PWM) switches a signal on and off at a fixed frequency; the duty cycle is the fraction of each period the signal is high. Given a frequency and duty cycle you get the period T = 1/f, the high (pulse) time tH = T·D, the low time tL = T − tH, and — for a digital pin driving a load — the average voltage Vavg = Vs·D (so a 5 V pin at 50% duty averages 2.5 V, effectively dimming an LED or setting a motor speed). Works the other way too: measure a pulse width and period to recover the duty cycle. Presets cover Arduino analogWrite (490 Hz), a 60 Hz dimmer, and RC servo signals (50 Hz, 1–2 ms pulses). Everything runs locally in your browser.
Timing & average voltage
Waveform
Recover duty cycle from a pulse
Frequency ⇄ period
The math. A PWM signal has period T = 1/f (seconds = 1 / hertz). With duty cycle D (as a fraction 0–1), the high time is tH = T·D and the low time is tL = T·(1−D) = T − tH. For an active-high digital output swinging between 0 and the supply Vs, the average (DC) voltage delivered to the load is Vavg = Vs·D — the area under one period divided by the period. Recover duty cycle from measured timing with D = tH / T (or D = tH·f), and duty in percent is 100·tH/T. RC servos use a 50 Hz carrier (T = 20 ms) with a 1–2 ms pulse encoding the angle (1.0 ms ≈ 5%, 1.5 ms = 7.5%, 2.0 ms = 10%); the wide 20 ms period is why the duty cycle looks tiny even though the pulse carries the command. Pairs with the Ohm's Law, LED Resistor, Voltage Divider, and RC Time Constant calculators. Everything runs locally — nothing leaves your browser.