capacitor on ac circuit

Updated More people should wonder why it does pass AC, rather than wondering why it blocks DC! After all, a simple capacitor, represented in diagrams, has two metallic plates in parallel separated by a small distance by air, a dielectric. By default, current can't cross the dielectric, so that's simply why DC can't pass. So what about AC: Actually when you say that a capacitor allows AC, it is true, but even in AC the current doesn't actually pass "through" the capacitor(a dielectric is still present). Before I can explain that, let me clarify a common misconception: A capacitor does not store charge. Of course, one plate of the capacitor, say the plate connected to the negative terminal of a DC supply, will accumulate electrons, accounting for negative charge. BUT here's what actually happens next: First, Remember that the space between the plates is separated by the dielectric. Therefore, these negative charge cannot pass through the dielectric itself, but the plate connected to the positive terminal(which is metallic) will deplete an equal amount of electrons, and that places a positive charge on that PLATE. 
So actually there is no crossing over. Just a depletion in one plate as a reaction to the accumulation in the other.  trailer ac unit for saleSince there is not gain of charge, the NET CHARGE IS ZERO. high efficiency air conditioner definitionNow after equal but opposite charge is depleted from the opposite plate the voltage appearing across the capacitor is the DC source voltage. ac and heater filtersIt's in an equilibrium and stays like that, so it's an open circuit since there is a dielectric in between (unless the voltage is so high that the dielectric breaks down). Energy is stored in the electrostatic field. The only current that appears before the Capacitor charges to the DC voltage level is the current that appears because of the opposite plate depleting electrons.
You'd have seen graphs with an exponential increase in voltage till the DC level and an exponential drop in current to zero.So that clears blocking DC I guess. You may wonder if net charge is zero, then what the formula  Q=CV means. Well it is simply the charge that is in a plate.Now coming to AC: If there is a dielectric in between, then how does current flow in AC? Remember AC periodically reverses the direction of current flow, as indicated by the sine wave and proceed. Let's consider the AC sine wave in two parts: The positive cycle and the negative cycle. In the positive cycle, the plate 1(say) depletes some electrons when its opposite plate(plate 2) accumulates electrons because of the polarity of that half cycle. Now when negative half cycle appears, a polarity reversal happens so the plate 1 will accumulate electrons and plate 2 will consequently rid itself of electrons. This will continue for every cycle and this accumulation and depletion cycle is what you see as "current flow".
Okay now you might be curious to know what happens inside the capacitor. The dielectric kind of expands like a rubber band (my own analogy, so don't stretch it too far, the analogy and the rubber band! ) But a stretched rubber band stores potential energy, like the dielectric between electrostatic fields, so it's an 'okay' analogy. Check this interactive animation to understand what happens: The Electrostatic Charge of a CapacitorMy favorite analogy, the water-rubber diaphragm analogy will make it super clear!A Water Tank AnalogyWritten A capacitor is two parallel plates with no electrical connection between them.  A wire is attached to each plate.  The plates can have a very large area and a very small gap between them.  They could be formed from two sheets of foil with a layer of paper between them and the whole thing rolled up to keep it compact.  But it's still just two large plates with a gap between them.If connect a battery to the two wires, a small amount of charge will flow for a short time. 
It will shove electrons onto one plate and suck electrons off the other plate.  Pretty soon, there is just a voltage difference between the two plates (equal to the battery voltage) and no more current is flowing.  It has come to a standstill.  That is the blocking DC part.  Direct current cannot keep flowing because there is no path for it to bridge the gap between the plates.  Now suppose we connect the battery for a few nanoseconds.  During that short time, a few electrons get sucked off one plate and roughly the same number get shoved on the other plate.  There is an electric field between the two plates due to have more electrons on one side than the other.  But the voltage has not yet built up to the battery voltage because we only connected it for a very short period of time.Now, quickly swap the battery terminals.  Now we suck back electons from where we shoved them before and we shove others out the other side where we previously took some away.  Let's do this for 2 nanoseconds. 
So now we have reversed the situation and we have the opposite electric field between the plates.  But we only let the current flow for a very short time.  Not enough to build up to the battery voltage.  Keep repeating that, alternating the direction of the current, but doing it so fast that it never saturates.  That is alternating current.  The circuits acts as though current is flowing through the plates. It isn't actually flowing, but the circuit behaves as though the AC is flowing through the capacitor.  Written I'll give you a hydraulic analogy.  Imagine you have a pipe with a thin sheet of rubber stretched across the end, a diaphragm.  Attached to the center of the diapragm is a steel rod, and attached to the steel rod is a piston in a cylinder set up as an air pump.  That is, when the piston moves, say, to the right, air is drawn into the chamber, and when the piston is moved to the left, that air is forced under pressure out of the chamber.Inserted in the other end of the pipe is another piston with a handle attached for your hand. 
You can push or pull on the piston, moving the water in the pipe.  Grab the handle and push forward (to the left).  The rubber diaphragm on the end of the pipe will balloon out, and it will force the piston into its cylinder, shoving air out under pressure, right?  But when the rubber diaphragm has stretched as far as you can push it (and it's stronger than you) the piston stops moving, and no more air flows.You've shoved as many electrons (water molecules) onto one capacitor plate (diaphragm) as it can take for the voltage (pressure) you've put on it.  If you push TOO hard, the diaphragm ruptures - or the capacitor fails.  Water moves until the pressure of the diaphragm equals the force you can apply to it, then it stops.Now, pull BACK on the handle past the point at which you started.  The diaphragm will deform in the other direction, right?  Air will flow into the cylinder.  If you stop there, that's the equivalent of simply reversing the polarity of the voltage across the capacitor. 
But if you alternate pushing and pulling, you can make the air compressor work, correct?  You're moving power through the capacitor, even though the water (electrons) in the capacitor never have to move very far.  The deformation of the diaphragm is analogous to the build-up and drop-off of the electric field across the capacitor.  In fact, both work very much like springs, and the equations describing them are very similar.Written Gautham has explained very well regarding why it blocks DC and what is going on etc. So I will skip " why it blocks DC part" and explain why it allows AC.You need to understand Amperes law.This is a differential form. All it says is . If current flows through a electric wire, there will be magnetic field around it. So if you add the magnetic field around the closed loop it is equal to the current enclosed. It's a pretty cool and simple equation. The problem isn't about stating a equation, but making sure that it's consistent with the natural world. There is a consistency test done on equations like these to test 'How apt they are'.
So while doing the same for the above equation. They ended withThis is called divergence of current density and it is zero. The divergence of a vector is another beautiful concept altogether. So in layman terms what is says is. The current flowing into the region is same as current flowing out of the region. i.e There is no divergence.But capacitor says I beg to differ. Consider an exampleThere is voltage source attached to a capacitor.Voltage source is changing(AC). As you can see there is current flowing into the capacitor terminal (red lines) but no electrons are flowing out of it. It means divergence of current density is not zero. So the above equations is false---Invalid----Maxwell found the inconsistency with the equation and made necessary changes to the above equationAnd thus he demonstrated that 'conduction current doesnt flows through a  capacitor but displacement current flows through the capacitor which is the rate of change of Electric field. It exists even in a medium without any free charges.