The difference between e.g. and i.e.

A lot of websites I have seen recently seem to use e.g. and i.e. interchangeably. However, they mean different things, and proper usage uses only the correct one. Which one should you use?