Many people think these two words are interchangeable, but they are not.
i.e. means that is, in other words, or more commonly, namely. The Latin term is id est.
e.g. means for example. The Latin term is exempli gratia.
The easiest way to remember this is to use the rule of association: i.e. means in other words, and that is; both have the letter “i.”
And, e.g. means for example; both have an “e.”
It should, also, be noted that i.e. and e.g. are not italicized, and they are best used in lists, parenthetical statements, and citations rather than in text.
Example:
The U.S. has many states that begin with the letter A (i.e., Alabama, Alaska, Arizona).
French fries go well with dipping sauce (e.g., ketchup, ranch dressing).
When it comes to using these terms in text, it is more acceptable to write out the meaning instead of using the abbreviation.
Example:
The U.S. has many states that begin with the letter A; namely (or in other words, that is), Alabama, Alaska, Arizona.
French fries go well with a dipping sauce, for example, ketchup, ranch dressing.
A quick word about punctuation. Because these are abbreviations, always use a period after each letter (but no spaces) and it is recommended by most style manuals to use a comma following i.e. and e.g. just as you would if you were spelling them out.
Happy writing!