Generally speaking a rug is smaller, and is not fixed or attached to the floor. A carpet, on the other hand, is always measured and cut to fit the exact proportions of the room or the space that is to be carpeted. It is fixed or attached to the floor.

A variant on rug is the throw rug - something small that can be rolled up, moved, slid around, etc. A carpet is fixed and permanent.

In spite of these general distinctions, the terms can sometimes be used interchangeably (at least in the US).

Source: http://forum.wordreference.com/showthread.php?t=1485619