How does a Faraday Cage work? I was reading some articles about lightning and i came across the term "Faraday cage". I know that it refers to an enclosure made out of a conductor that can block electric fields. But what i want to know is the physics behind it in terms of charges and electric fields.
 A: There are related questions such as Why does an Faraday Cage protect you, but I don't think they answer fully the question the OP has in the comments. 
If you are inside the cage, and it is hit by a large spark, such as lighning or a deliberate electrostatic discharge, the resulting current will stay on the outside of the cage and no current will pass inside, provided the cage mesh size is small enough and thick  enough, that is the gaps between the wires are smaller than the wavelength of the external radiation. 

The part that i don't get is that it says that it can cancel the electric field inside the cage when an external electric field is applied.

From Wikipedia Faraday Cages

Externally or internally applied electromagnetic fields produce forces on the charge carriers (usually electrons) within the conductor; the charges are redistributed accordingly (that is, electric currents are generated). Once the charges have rearranged so as to cancel the applied field inside, the currents stop.



Animation showing how a Faraday cage (box) works. When an external electrical field (arrows) is applied, the electrons (little balls) in the metal move to the left side of the cage, giving it a negative charge, while the remaining unbalanced charge of the nuclei give the right side a positive charge. These induced charges create an opposing electric field that cancels the external electric field throughout the box.

Take an internally applied field as it acts the same way as an external field, but might be easier to follow intutively.
Think of the cage as a real version of the the conduction shell,  that you learn about when initially studying electromagnetism. External (or internal) electric fields act to redistribute the electrons,  because of mutual repulsion, (the electrons get as far apart from each other as surface and charge density allows. This causes a temporary flow of current which ceases when the electrons have stopped moving.
Now you bring a charge with you inside the ungrounded cage, this will produce an electric field on the internal side of the cage, as it acts to neutralise the field within the cage. The direct effect of this inner side electron rearrangement is to produce a charge on the ouside of the cage that is equal in magnitude (and with the same  polarity) as the charge you brought in.
In other words, if you bring in a positively charged object, this attracts all the cage's free  electrons to the inner surface of the cage, leaving a net positive charge on the outer surface.  Now it does not make any difference where you place the charge within the shell, the cage generates the same DC electric field that it would generate if it were simply affected by the charge placed inside. The inner and outer charges act to cancel each other out.
Now you ground the cage, providing a route for excess charge to leave the outer side of the shell, so you are left  with the inner side of the shell neutralising the charge you have brought in. 
A: The external electric field induces charges on the outside of the cage which, inside the cage and the conductor of which the cage is made, produce an electric field which is exactly equal and opposite to the external electric field.
Thus the net electric field inside the cage is zero.
A: A Faraday cage can be considered as an approximation of an ideal hollow conductor. If there is an electric field outside the cage, then it will create forces on the charges on the conductor surface and this will cause the surface charge to be redistributed accordingly so as to cancel the effect of the external field. This we say as achieving  electrostatic equilibrium.

How it works?   

A conductor, has free charges (usually electrons) on it's surface. These free charges, in the absence of an electric field are so distributed such that the net electric field created by the whole charges vanish. This state, which we normally call as the neutral state, is actually electrostatic equilibrium. Hence no net current flows through a conductor in the absence of an external field (or when it is in electrostatic equilibrium).
Now, if you place such a conductor in the presence of an electric field, then there is an unbalanced force (given by $F=qE$) now acting on the charges which causes them to make a new rearrangement so as to nullify the effect of the external field and thereby reducing their free energy and to attain equilibrium . This redistribution we see as a current flowing through the conductor surface. The current flows (or the charges redistribute) until electrostatic equilibrium is reached.   
So, if there is an external field outside our hollow conductor, it will cause a redistribution of the electrons on the conductor surface cancelling the external field. This prevents any electric field to be present beneath the conductor surface. This phenomenon of shielding is made used in Faraday's cage.  
If there is an electric field inside a conductor, which is not grounded, it will again cause a redistribution of electrons on the outer surface due to induction in the inner surface, the inside electric field. If it is grounded, the excess current on the surface flows to the ground, keeping it neutral.  
However, it could not block magnetic fields as magnetic fields have no effect on static charges (more precisely, charges under electrostatic equilibrium).
