The process of charging a capacitor is relatively straightforward. When a capacitor is charged, it is connected to a direct current voltage source. It is possible that this is a battery or a DC power supply.
The capacitor will charge to the voltage produced by the DC voltage source as soon as it is connected to the DC voltage source’s output. A capacitor will charge to the maximum voltage of a 9-volt battery when it is attached to a 9-volt battery. In the case of a capacitor linked to a DC power supply that produces 15 volts, the capacitor will charge to a maximum of 15 volts. Simply connecting the positive side of the DC voltage source to the positive side of the capacitor, via the longer lead, and connecting the negative side of the DC voltage source to the negative side of the capacitor, via the shorter lead, is all that must be done.
The following is a circuit diagram showing how a capacitor is charged:

Fill a Capacitor with Electricity
In this situation, the capacitor charges to a maximum of 9 volts, due to the connection of the capacitor to a 9-volt battery. When charging a capacitor, it is common practice to connect a resistor in series with the capacitor and the voltage source in order to reduce the amount of current that goes through the capacitor and prevent the capacitor from being permanently damaged. This is usually the preferred course of action.