If you had a refrigerator in a closed, well-insulated room and you left the fridge door open for a long time, what would happen to the temperature in the room?
In the long run the room would get warmer. When you first open the fridge door and the cold air comes out, the room cools down a little temporarily. The fridge would then work to cool the inside of the fridge. As we will see, more heat is transferred from the cooling coils of the fridge to the room than is removed from inside the fridge - this would ultimately warm the room.
Any device, like a refrigerator or air conditioner, that removes heat from a cold region and transfers it to a hot region is basically a heat engine in reverse. Work W is done on the system, causing heat Qc to be transferred from the lower-temperature region. Heat Qh is transferred from the system at a higher temperature.
By conservation of energy:
W + |Qc| = |Qh|
A refrigerator or air conditioner consists of a fluid pumped through a closed system. Four steps are involved in the cycle.
A refrigerator is rated by its coefficient of performance K, the ratio of the heat removed from the fridge to the work required to remove it: