Flyback Converter Simulator Back
Power Electronics

Flyback Converter Simulator

Design the simplest isolated DC-DC converter — the circuit inside almost every AC adapter and phone charger. Adjust the input voltage, duty cycle and turns ratio to see the output voltage, primary peak current and boundary-mode primary inductance update in real time.

Parameters
Input voltage V_in
V
Rectified, smoothed primary-side DC bus voltage
Duty cycle D
Fraction of the period the switch is ON
Turns ratio N_p:N_s (n = N_p/N_s)
Primary turns divided by secondary turns
Switching frequency f_sw
kHz
Rate at which the switch turns ON and OFF
Output power P_out
W
Power delivered to the load (assumed lossless)
Results
Output voltage V_out (V)
Output current I_out (A)
Primary peak current I_pk (A)
Primary inductance L_p (µH)
Stored energy (mJ/cycle)
Operating mode
Flyback circuit — switching action

With the switch ON, energy is stored in the primary winding (primary current ramps up); with it OFF, the secondary winding delivers that energy to the output (secondary current ramps down). The dots mark the coupling polarity of the windings.

Output voltage vs duty cycle D
Output voltage vs turns ratio n
Theory & Key Formulas

$$V_{out}=V_{in}\cdot\frac{D}{1-D}\cdot\frac{N_s}{N_p}$$

Ideal continuous-conduction-mode (CCM) output voltage. D: duty cycle, N_p/N_s = n: turns ratio. The output voltage is set by both the duty cycle and the turns ratio.

$$L_p=\frac{(V_{in}D)^{2}}{2\,P_{out}\,f_{sw}},\qquad I_{pk}=\frac{2\,P_{out}}{V_{in}D}$$

Boundary-mode (CCM/DCM boundary) primary inductance L_p and primary peak current I_pk. f_sw: switching frequency, P_out: output power.

$$E_{cycle}=\frac{P_{out}}{f_{sw}}=\tfrac{1}{2}L_p I_{pk}^{2}$$

Energy is stored in the coupled inductor during the ON-time and released during the OFF-time. The energy transferred per switching cycle equals the output power divided by the switching frequency.

What is the Flyback Converter Simulator?

🙋
A "flyback converter" — I've never heard the term. Is it really the circuit inside a phone charger?
🎓
It really is. Almost every small AC adapter, phone charger and standby power supply is a flyback converter. It's the simplest circuit among the "isolated DC-DC converters" — few parts, low cost. That's why it dominates small power supplies in the roughly 5 W to 100 W range.
🙋
There's a transformer inside, right? Is it different from an ordinary transformer?
🎓
Good question. It looks like a transformer, but inside it is really a "coupled inductor" — two coils linked magnetically. An ordinary transformer passes energy straight through, with primary and secondary carrying current at the same time. A flyback does not. While the switch is on, the input voltage drives a current into the primary winding and "deposits" energy into the air gap of the magnetic core. When the switch turns off, the magnetic field collapses and that deposit is "withdrawn" through the secondary winding into the output capacitor and load. Store, then release — over and over.
🙋
I see, it stores the energy first. So what does "isolated" mean? In the circuit diagram on the left, the primary and secondary are drawn apart.
🎓
That's the most important point about a flyback. The primary and secondary windings are coupled only magnetically — electrically they are completely separate. This is called galvanic isolation. Because the primary side, connected to 100 V or 200 V mains, is electrically separated from the secondary side a user touches, you can build a safe power supply with no shock hazard. And by adding just one more secondary winding, you get an extra isolated output almost for free — handy for devices that need several voltages.
🙋
How is the output voltage set? On the left I can adjust both the duty cycle D and the turns ratio n.
🎓
Right — having two knobs is what makes the flyback so flexible. The output voltage is V_out = V_in·D/((1−D)·n). The standard split is to let the turns ratio n set the coarse voltage ratio and the duty cycle D handle fine adjustment and feedback control. To make 5 V from a 100 V input, for example, you use a fairly large turns ratio to drop the voltage hard and run D around 0.4 for stable operation. Move D or n on the charts on the left and you can see at a glance how the output voltage changes.
🙋
The result shows an "operating mode" — what are CCM and DCM?
🎓
It's about whether the coil empties out all its energy during the switch-off time. If it fully empties before the next cycle starts, that's DCM (discontinuous conduction mode); if the next cycle starts before it empties, that's CCM (continuous conduction mode). This tool computes the primary inductance L_p at the "boundary mode" — the design point where the next cycle starts exactly as the coil empties. In practice engineers use the boundary mode as a reference point, then nudge the design slightly toward CCM or DCM to tune the characteristics.

Frequently Asked Questions

In the ideal continuous-conduction-mode (CCM) equation, the output voltage is V_out = V_in·D/((1−D)·n), where D is the duty cycle and n is the turns ratio N_p/N_s. Unlike a buck converter, the output voltage is set by two independent knobs — the duty cycle D and the turns ratio n. For example, with 100 V input, D=0.4 and n=5, V_out = 100·0.4/(0.6·5) = 13.3 V. A common design lets the turns ratio set the coarse voltage ratio while the duty cycle handles fine adjustment and feedback control.
The primary inductance that sits exactly on the boundary between continuous conduction mode (CCM) and discontinuous conduction mode (DCM) is L_p = (V_in·D)²/(2·P_out·f_sw), where f_sw is the switching frequency. At this inductance the converter operates right at the CCM/DCM boundary (boundary mode). A smaller inductance pushes it into DCM, a larger one toward CCM. The boundary value is a convenient design reference point, and this tool reports L_p in microhenries.
The boundary-mode primary peak current is I_pk = 2·P_out/(V_in·D). This peak current directly drives the current rating of the switch (MOSFET), the magnetic-core saturation margin and the winding heating. A larger peak current needs bigger, more expensive parts, and if the core saturates the inductance collapses and the current runs away. Peak current rises as the input voltage falls and as the duty cycle shrinks, so operation at low input voltage is the hardest condition for a flyback design.
In a flyback converter the primary and secondary windings are only magnetically coupled — there is no direct electrical connection between them. This is called galvanic isolation. While the switch is on, the primary winding stores energy in the core's air gap; while it is off, the secondary winding releases that energy. Because there is no DC conduction path, the input (mains side) and the output (the side a user touches) are separated, which is essential for safety compliance. Adding extra secondary windings also gives multiple isolated outputs almost for free.

Real-World Applications

AC adapters and USB chargers: Laptop AC adapters, phone chargers and the bundled supplies of all kinds of equipment are almost all flyback converters. They rectify and smooth mains 100/200 V AC into a primary-side DC bus of tens to a few hundred volts, then use the flyback to convert it to isolated low-voltage outputs such as 5 V, 12 V or 20 V. Because they have few parts and low cost, they dominate small supplies in the 5 W to 100 W range. In USB PD chargers the turns ratio is fixed and the output voltage is varied through duty-cycle feedback control.

Standby power supplies: As the standby supply in TVs, microwave ovens and air conditioners, the flyback is favoured for its high efficiency even at light load. To feed a few watts to a remote-control standby circuit or a microcontroller, designers lean toward discontinuous conduction mode (DCM) for light-load efficiency. With tightening standby-power regulations, combining the flyback with burst-mode control to keep standby consumption below 0.1 W is now mainstream.

Auxiliary supplies in industrial equipment: Inside inverters, PLCs and servo amplifiers, the flyback is widely used as an auxiliary supply that generates control-circuit rails such as ±15 V and 5 V from the high-voltage DC bus of the main circuit. Because adding multiple secondary windings yields multiple isolated outputs, isolated gate-drive supplies can be built cheaply. A wide input-voltage range (universal input) is another strength of the flyback.

Pre-study for power-supply design and education: Before a detailed SPICE simulation or a prototype, an ideal-equation estimate like this tool gives a first read on roughly what the output voltage, peak current and primary inductance will be. Using the boundary-mode L_p as a reference point, you can size the core and choose the switch rating before entering detailed design. Conversely, if the SPICE result differs from this estimate by an order of magnitude, it is a sanity check that points to a turns-ratio or duty-cycle input mistake.

Common Misconceptions and Pitfalls

The biggest misconception is that "a flyback transformer is the same as an ordinary transformer". The flyback "transformer" is not a normal transformer that passes energy straight through — it is a coupled inductor that stores energy temporarily. That is exactly why an air gap is built into the magnetic core, so it can store energy without saturating. Use a core with no gap and the primary peak current saturates it almost immediately; the inductance collapses, the current runs away and the switch is destroyed. The boundary-mode primary inductance L_p this tool computes is the starting point for that core design.

Next, trusting the ideal output-voltage equation as-is. The formula V_out = V_in·D/((1−D)·n) used here assumes zero loss and ideal coupling. In reality there are leakage inductances of the primary and secondary windings, winding resistance, the forward voltage drop of the diode and the on-resistance of the switch, all of which pull the output voltage below the ideal value. At low output voltages (5 V or less) the 0.5 to 1 V diode drop is far from negligible. Leakage inductance also produces a high-voltage spike when the switch turns off, and unless a snubber absorbs it the switch is destroyed. The ideal equation is for first-pass estimation; the final design must account for losses and parasitics.

Finally, the belief that "a larger duty cycle is always better". The output-voltage equation shows that pushing D toward 1 raises V_out, but designs above D=0.7 are avoided in practice. The reasons are that (1) the voltage across the primary winding when the switch is off rises with the duty cycle and can exceed the switch's voltage rating, (2) the voltage reflected back through the transformer from the secondary (the reflected voltage) becomes large, and (3) control stability worsens. A flyback is generally designed around D=0.3 to 0.5, with the turns ratio n providing most of the voltage ratio. The duty cycle is kept as headroom for feedback control.

How to Use

  1. Set input voltage (Vin) between 12–48 V using the slider or numeric field; typical AC adapter input is 24 V after rectification.
  2. Adjust duty cycle (D) from 0.1 to 0.9; higher duty increases output voltage but reduces transformer turns ratio benefit.
  3. Define primary-to-secondary turns ratio (n) typically 2–10; lower ratios suit step-down designs (24 V to 5 V requires n ≈ 4.8).
  4. Set switching frequency (fsw) between 50–500 kHz; 100 kHz is standard for phone chargers to minimize transformer core losses and EMI.
  5. Read output voltage, primary inductance, peak magnetizing current, and operating mode (continuous or discontinuous conduction).

Worked Example

Design a 5 V/2 A charger from 24 V input. Set Vin = 24 V, fsw = 100 kHz, duty cycle D = 0.3. For output voltage regulation, Vout = Vin × D / n, so with n = 4.8, Vout ≈ 1.5 V (step-down primary side). Adjust D to 0.5 and turns ratio to n = 2.4 to achieve Vout = 5 V exactly. Primary inductance Lp should store Epk = (Vin × D)² / (2 × Lp × fsw × Iout); typical values range 20–100 µH for 5 V/2 A output. Peak primary current limits transformer saturation: Ipk = 2 × Pout × D / (Vin × (1−D)) ≈ 0.67 A at 10 W output.

Practical Notes

  1. Discontinuous conduction mode (DCM) occurs when primary inductance is small relative to load; common in light-load phone chargers below 5 W because it improves transient response and reduces noise.
  2. Increase Lp if peak current exceeds 3 A in a 24 V design; oversized inductance causes slow turnoff and reduces efficiency below 80%.
  3. Switching frequency trade-off: 50 kHz reduces switching losses but demands larger transformer core; 200 kHz cuts transformer size by 60% but increases MOSFET gate drive power.
  4. Output filter capacitor ESR must be < 0.1 Ω for 5 V rails to keep ripple below 50 mV; ceramic X7R types (10–47 µF) are standard.