A capacitor does not stop being dangerous when the power goes off. It holds its charge in an electric field, and the stored energy, half C V squared, grows with the square of the voltage. A small capacitor at low voltage holds a harmless whisper of energy. A photoflash capacitor, a few hundred microfarads at 300 volts, holds tens of joules, delivered in an instant if shorted, enough to weld a screwdriver tip and give a serious shock. Power supply capacitors in tube amplifiers and microwave ovens sit in the same class, and they can hold their charge for days if no bleed resistor is fitted.
In theory, leakage through the dielectric and any connected circuitry drains a capacitor over time. In practice the timescale is anyone's guess: a capacitor disconnected at the peak of its charge, in a circuit whose power switch isolates it, may keep most of its voltage for a very long time. Equipment that is unplugged is not equipment that is safe. Television and monitor repairers learned this the hard way from picture tube capacitances that bit hours after switch-off. The only honest test is a meter, and the only honest treatment is to discharge deliberately, then measure again, because dielectric absorption can let a seemingly drained capacitor recover a surprising fraction of its voltage.
Discharge through a resistor, never a screwdriver short: a few kilohms at a suitable power rating for small parts, a proper discharge probe for high-voltage work, held for several seconds and then repeated. Watch the voltage fall on a meter as you do it, and keep one hand in your pocket when working near high voltage so a shock cannot cross the chest. Designers help by fitting bleed resistors across stored-energy capacitors; if you are building something with serious capacitance, fit one and choose its time constant deliberately. The capacitor energy calculator shows exactly how many joules a given part holds at a given voltage, which turns vague caution into a number you can plan around. Size is a poor guide to danger, and topology matters more. A tiny capacitor in a photoflash or a defibrillator charges to hundreds of volts through a converter, and a physically large capacitor at 5 volts may hold less energy than a small one at 400, because voltage counts squared. Series strings in high-voltage equipment add another trap: leakage differences can leave one capacitor holding far more than its share long after shutdown, which is why balancing and bleed resistors are fitted across each one. When in doubt, the routine never changes: assume it is charged, measure it, discharge it through a resistor, measure it again. Thirty seconds of patience is the cheapest safety equipment in the workshop.
The free calculator that goes with this guide:
Open the capacitor energy calculator