The basic principle behind a freezer is evaporation. When a liquid evaporates it causes the surrounding area to cool. For example, on a hot summer's day if you sprinkle water on your skin it will cool your skin as you evaporate. That's an example of refrigeration!
A refrigerator and a freezer both work in a similar way except the temperature of the refrigerator is kept a little above the freezing point to avoid the decay of food products. A freezer maintains the temperature of up to -18 degrees, it keeps food frozen. Every refrigerator has a compressor and uses a compression cycle in order to keep the inside of the refrigerator cool. A refrigerant called "Freon" is used in this cycle. This agent is in the form of a vapour and it enters the compressor at its boiling point, where it is compressed.
At this point, the vapour is superheated and is condensed in to a saturated liquid. It then goes to an expansion valve where the pressure is decreased and the vapour evaporates. This liquid is not cool and partially vaporized. It travels through the coil that you see behind your refrigerator, where a fan totally vaporizes the refrigerant and makes it enter the freezer where it keeps the food frozen.