Duty Cycle Calculator Formula
Understand the math behind the duty cycle calculator. Each variable explained with a worked example.
Formulas Used
Duty Cycle
duty_cycle_pct = on_time_us / period_us * 100Off Time
off_time = period_us - on_time_usFrequency
frequency = 1e6 / period_usDuty Ratio
duty_ratio = on_time_us / period_usVariables
| Variable | Description | Default |
|---|---|---|
on_time_us | On Time (Pulse Width)(µs) | 500 |
period_us | Total Period(µs) | 1000 |
How It Works
What is Duty Cycle?
Duty cycle is the fraction of one period during which a signal is in its active (high) state.
Formula
Duty Cycle = On Time / Period x 100%
Off Time = Period - On Time
Duty cycle is fundamental to PWM (Pulse Width Modulation), which controls motor speed, LED brightness, and power delivery by varying the on-time while keeping frequency constant.
Worked Example
A 1 kHz signal with 500 microsecond on-time.
on_time_us = 500period_us = 1000
- 01Duty cycle: 500 / 1000 x 100 = 50.0%
- 02Off time: 1000 - 500 = 500 microseconds
- 03Frequency: 1,000,000 / 1000 = 1000 Hz
Ready to run the numbers?
Open Duty Cycle Calculator