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 * 100

Off Time

off_time = period_us - on_time_us

Frequency

frequency = 1e6 / period_us

Duty Ratio

duty_ratio = on_time_us / period_us

Variables

VariableDescriptionDefault
on_time_usOn Time (Pulse Width)(µs)500
period_usTotal 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
  1. 01Duty cycle: 500 / 1000 x 100 = 50.0%
  2. 02Off time: 1000 - 500 = 500 microseconds
  3. 03Frequency: 1,000,000 / 1000 = 1000 Hz

Ready to run the numbers?

Open Duty Cycle Calculator