Skip to content
Simulation · Electronics

Capacitor charging and discharging simulator

Throw the switch and watch a capacitor fill through a resistor. The voltage and current plots mark one to five time constants, and the energy card shows where every joule from the supply ends up.

Flip the switch or change R and C
Switch
100 kΩ
10 µF
5 V
Time constant RC1 s
Capacitor voltage0.00 V
Current50 µA
Energy stored0 J
Heat in resistor0 J

One number sets the pace

Resistance times capacitance is a time. Double either one and every point on the curve takes twice as long to reach.

τ = R × C

Fast at first, then slower

The current starts at V ÷ R and falls as the capacitor fills. After one τ the capacitor is at 63.2%, after five τ at 99.3%.

v = V (1 − e−t/τ)

Half the energy is heat

A full charge takes CV² from the supply. Half ends up stored in the capacitor and the other half warms the resistor, whatever its value.

E = ½ C V2

How long does a capacitor take to charge?

A capacitor charging through a resistor follows one clock, the time constant τ = R × C. After one τ it reaches 63.2% of the supply voltage, after three τ 95.0%, and after five τ 99.3%, which is usually treated as fully charged. With 100 kΩ and 10 µF, τ is 1 s, so the capacitor is effectively full after about 5 s. Discharging runs the same clock in reverse: 36.8% left after one τ, 0.7% after five.

The simulation puts a battery, a two-way switch, a resistor and a capacitor on the bench. Flip the switch and the voltage climbs while the current falls, both marked at one to five time constants. The energy card shows the part most textbook pages leave out: a full charge always loses exactly half the supply's energy as heat in the resistor, whatever the resistance. For the full story of where that energy goes, read where half the energy goes when a capacitor charges.

Key results from the simulation

  • τ = R × C sets every time: 100 kΩ × 10 µF = 1 s, 10 kΩ × 100 nF = 1 ms, 10 Ω × 1 F = 10 s.
  • The landmarks never change: 63.2% at 1τ, 86.5% at 2τ, 95.0% at 3τ, 98.2% at 4τ, 99.3% at 5τ. Half charge takes 0.693τ and 90% takes 2.30τ.
  • Current is largest at the start: the first instant draws V ÷ R, 50 µA for 5 V and 100 kΩ, then falls by the same 63.2% steps as the voltage rises.
  • Stored energy is ½CV²: 0.125 mJ for 10 µF at 5 V, 3.65 J for a 1 F supercapacitor at 2.7 V, 6.53 J for a 120 µF flash capacitor at 330 V.
  • Half the energy is lost in R: a full charge draws C × V² from the supply. ½CV² ends up in the capacitor and ½CV² heats the resistor, for any value of R.

Six RC circuits to try

Each card loads a circuit into the simulator. Time constants between 0.4 s and 3 s run in real time; faster or slower circuits are rescaled so one τ takes about 1.2 seconds on screen, and the corner label says by how much.

A one-second RC: 100 kΩ and 10 µF

5 V · 100 kΩ · 10 microfarad · charge

100 kΩ times 10 µF is 1 second, so this circuit runs in real time. When the switch moves to charge, the full 5 V appears across the resistor and 50 µA flows. After one second the capacitor is at 3.16 V, 63.2% of the supply, and the current has fallen to 36.8% of its start.

The curve keeps slowing because the gap between supply and capacitor keeps shrinking, and that gap is what drives the current. Half charge takes 0.693 s, 90% takes 2.3 s, and 99.3% takes 5 s. The RC time constant post shows why the 63.2% figure is 1 − 1/e.

Related reading: Why 63.2 percent

Time constant 1 s At 1τ 3.16 V Peak current 50 µA Stored when full 0.125 mJ

The same circuit, discharging

5 V start · 100 kΩ · 10 microfarad · discharge

Flip the switch the other way and the capacitor becomes the source. It pushes current backwards through the same resistor, starting at 50 µA, and its voltage falls to 1.84 V (36.8%) after one second and 34 mV after five.

The energy card now shows the stored 0.125 mJ draining into the resistor as heat. Nothing is lost in a different way during discharge: all the energy the capacitor held ends up in R.

At 1τ 1.84 V At 5τ 34 mV Peak current 50 µA Heat in R 0.125 mJ

A button debounce filter: 10 kΩ and 100 nF

5 V · 10 kΩ · 100 nF · charge

A common hardware debounce puts 10 kΩ and 100 nF on a button input. τ is 1 ms, so the capacitor needs about 0.69 ms to cross half the supply and 5 ms to settle. Contact bounce lasts a few milliseconds, and the capacitor averages it into one smooth edge.

The simulator slows this circuit down by about 1,200 times so you can watch it. The button debounce capacitor post works through how to pick R and C for a given bounce time.

Related reading: Choosing a debounce capacitor

Time constant 1 ms Half way 0.69 ms Settled (5τ) 5 ms Peak current 0.5 mA

The RC inside a 555 timer

9 V · 68 kΩ · 10 microfarad · charge

A 555 timer is an RC charging circuit with two comparators. With 68 kΩ and 10 µF, τ is 0.68 s. The chip never lets the capacitor charge from zero: it switches between one third and two thirds of the supply, and the climb from 33.3% to 66.7% takes ln 2 × τ = 0.471 s.

That ln 2, 0.693, is where the 555 frequency formula gets its constant. On the voltage plot, the stretch from 3 V to 6 V on a 9 V supply sits on the steep early part of the curve, which is why a 555 is not very sensitive to small changes in supply voltage. The 555 astable post builds a full flasher from it.

Related reading: The 555 astable circuit

Time constant 0.68 s ⅓ to ⅔ V 0.471 s Thresholds 3 V and 6 V Peak current 132 µA

A 1 F supercapacitor through 10 Ω

2.7 V · 10 Ω · 1 F · charge

A 1 F supercapacitor rated 2.7 V, such as the Eaton HV0810-2R7105-R, stores ½ × 1 × 2.7² = 3.65 J. Charging it through 10 Ω gives τ = 10 s, so it needs about 50 s to fill. The first instant draws 0.27 A, the reason supercapacitors are usually charged through a current limit.

The heat bar ends at 3.65 J too, the same as the stored energy. Lowering R to 1 Ω would charge it ten times faster with ten times the starting current, but the resistor would still take exactly half. The part's own internal resistance, about 0.2 Ω, adds to R.

Time constant 10 s Full (5τ) 50 s Stored 3.65 J Peak current 0.27 A

Bleeding a 330 V camera flash capacitor

330 V start · 1 MΩ · 120 microfarad · discharge

A photoflash capacitor in a small camera is typically 80 to 240 µF charged to 180 to 330 V. At 120 µF and 330 V it holds 6.53 J. A 1 MΩ bleed resistor gives τ = 120 s, two minutes, and after five τ (10 minutes) the capacitor still holds 2.2 V.

It takes about 3.4 minutes just to fall below 60 V. A bleeder resistor makes a charged capacitor safer over time, not instantly safe, so always measure the voltage before you touch the terminals.

Time constant 120 s Stored 6.53 J After 5τ 2.2 V Below 60 V 3.4 min

Charge and discharge at each time constant

TimeCharging (% of supply)Discharging (% left)Current (% of peak)Energy stored (% of full)With 100 kΩ, 10 µF, 5 V
0.5τ39.3%60.7%60.7%15.5%1.97 V after 0.5 s
1τ63.2%36.8%36.8%40.0%3.16 V after 1 s
2τ86.5%13.5%13.5%74.8%4.32 V after 2 s
3τ95.0%5.0%5.0%90.3%4.75 V after 3 s
4τ98.2%1.8%1.8%96.4%4.91 V after 4 s
5τ99.3%0.7%0.7%98.7%4.97 V after 5 s

Charging starts from 0 V and discharging starts from the full supply voltage. Stored energy grows with the square of the voltage, so at one time constant the capacitor is at 63.2% of the voltage but only 40.0% of its final energy.

How the simulation works

The circuit is ideal: a battery with no internal resistance, a switch that moves instantly, a resistor R and a capacitor C. While charging, Kirchhoff’s voltage law gives V = iR + q/C, and solving it gives v(t) = V (1 − e^(−t/τ)) and i(t) = (V/R) e^(−t/τ) with τ = RC. While discharging from V the capacitor voltage is v(t) = V e^(−t/τ) and the current flows the other way.

The energy card uses E = ½Cv² for the stored energy. The heat in the resistor is the integral of i²R, which for a charge from 0 V comes to ½CV² (1 − e^(−2t/τ)). After one τ the resistor has already taken 86.5% of its final share, because the current is largest at the start.

The plots run to six time constants with gold dots at one to five τ. Time constants from 0.4 s to 3 s play in real time; anything faster or slower is rescaled so one τ lasts 1.2 seconds on screen, and the moving dots in the circuit speed up and thin out as the current falls.

Resistors step through the E12 series from 10 Ω to 10 MΩ and capacitors through the E6 series from 1 nF to 1 F, the standard values you can buy.

What the model leaves out

  • Leakage: real capacitors, electrolytics especially, leak a small current, so a capacitor charged through 10 MΩ may never reach the supply voltage.
  • Internal resistance: the battery, the switch and the capacitor itself (its ESR) all add resistance in series. With a 10 Ω resistor and a supercapacitor, the 0.2 Ω ESR shifts τ by about 2%.
  • Tolerance: electrolytic and supercapacitor values are often −10% to +30% or ±20%, so a real RC timer can be off by that much before anything else.
  • Dielectric absorption: a discharged electrolytic or film capacitor can recover some voltage after the short is removed. Large high-voltage capacitors are stored with their terminals shorted for this reason.
  • Switch bounce and inductance: at very small R the wiring inductance limits the first rush of current, and real switch contacts bounce.

Common misconceptions

“A bigger resistor wastes less energy while charging.” It does not. A bigger R charges more slowly with a smaller current, but over a full charge the resistor still turns ½CV² into heat. Only charging in small voltage steps or with an inductor avoids the loss.

“After 5τ the capacitor is empty.” It holds 0.7% of its voltage. That is negligible at 5 V and still about 2 V on a 330 V flash capacitor. Count from the voltage you need to reach, not from a fixed number of τ.

Frequently asked questions

How long does it take a capacitor to charge?

About five time constants, 5 × R × C, to reach 99.3% of the supply. With 100 kΩ and 10 µF that is 5 seconds. It reaches 63.2% after one time constant and 95.0% after three.

What is the formula for charging a capacitor?

v(t) = V (1 − e^(−t/RC)), where V is the supply voltage, R the series resistance and C the capacitance. The current is i(t) = (V/R) e^(−t/RC), largest at the start and falling toward zero.

How much energy does a capacitor store?

E = ½CV². A 10 µF capacitor at 5 V stores 0.125 mJ, a 1 F supercapacitor at 2.7 V stores 3.65 J and a 120 µF flash capacitor at 330 V stores 6.53 J.

Why is half the energy lost when charging a capacitor?

The supply delivers all of the charge Q = CV at the full voltage V, so it supplies QV = CV². The capacitor only ends up with ½CV², because each bit of charge went in at the lower voltage the capacitor had at the time. The difference is turned into heat in the resistance, whatever its value.

How long does a capacitor take to discharge?

The same time constant applies: it falls to 36.8% of its starting voltage after RC seconds and to 0.7% after 5RC. For a high-voltage capacitor that remainder can still be dangerous, so measure before touching.

What is the charging current of a capacitor?

At the instant the switch closes the current is V ÷ R, because the empty capacitor has no voltage across it. With 5 V and 100 kΩ that is 50 µA. After one time constant it has fallen to 36.8% of that, and after five to 0.7%.

Keep learning

More simulations