PWM duty cycle calculator

Enter the PWM frequency and either the pulse width or the duty cycle. The calculator gives the other one, the period and the off-time, the average and the RMS voltage of the signal for the high level you enter, and the compare value for a PWM register with the chosen number of bits.

Find
Hz
ms
V
Duty cycle25 %
Average voltage
1.25 V
RMS voltage
2.5 V
Period
1 ms
Off-time
0.75 ms
Period ÷ pulse width
4
Register value
64
Full-scale value (2ⁿ − 1)
255

Runs in your browser: nothing you enter is sent anywhere.

How to use it

  1. Choose what you want to find: the duty cycle from a pulse width, or the pulse width from a duty cycle.
  2. Enter the frequency in Hz.
  3. Enter the pulse width in milliseconds, or the duty cycle in percent.
  4. Enter the high voltage level and the resolution of your PWM peripheral in bits (8 is a common default).

Formulas

  • Period T = 1 ÷ f
  • Duty cycle D = t_on ÷ T, and back t_on = D × T; off-time T − t_on
  • Average voltage V_avg = V × D (low level 0 V)
  • RMS voltage V_rms = V × √D
  • Register value = round(D × (2ⁿ − 1))
  • Period ÷ pulse width = 1 ÷ D

Worked example

A 1 kHz PWM with 0.25 ms pulses at 5 V:

  • T = 1 ÷ 1000 = 1 ms, D = 0.25 ÷ 1 = 25 %
  • off-time 0.75 ms; period ÷ pulse width = 4
  • average 5 × 0.25 = 1.25 V, RMS 5 × √0.25 = 2.5 V
  • 8-bit register: 0.25 × 255 = 63.75 → 64

A hobby servo signal of 50 Hz with a 1.5 ms pulse has a 20 ms period and a 7.5 % duty cycle.

Tips

  • Frequency and resolution trade off. A timer with a fixed clock gives fewer steps at higher PWM frequencies.
  • Average voltage needs a load that averages: a motor, an LED seen by the eye or an RC filter. The instantaneous voltage is still 0 or V.
  • Inverted outputs produce 100 % − D; check whether your pin is active high or low.

Frequently asked questions

How do I calculate the duty cycle?

Duty cycle = pulse width ÷ period × 100 %, and the period is 1 ÷ frequency. A 0.25 ms pulse at 1 kHz (1 ms period) is a 25 % duty cycle.

What is the average voltage of a PWM signal?

For a signal switching between 0 V and V it is V × D. A 5 V signal at 25 % averages 1.25 V — what a motor or a filtered output sees.

Why is the RMS voltage different from the average?

RMS is V × √D and decides heating in a resistor. At 25 % it is 5 × 0.5 = 2.5 V, twice the 1.25 V average.

What register value gives a given duty cycle?

For an n-bit PWM the value is D × (2ⁿ − 1), rounded. 25 % with 8 bits is 0.25 × 255 = 63.75, so 64.

More in Unit converters

All tools in this category: Unit converters ·Updated November 4, 2026

Privacy choices

Google Analytics shows us which tools are used and whether they work. It may set cookies. Your choice is kept in this browser.