These two are easily confused. I had four semesters of Latin in college and I still have to remind myself of correct usage. Although both phrases are originally Latin, they are part of the English language, and thus do not require italicizing like we so often do with foreign words or phrases.
In Latin, i.e. stands for id est, while e.g. stands for exempli gratia. The former means “in other words,” while the latter means “for example.”
I see the two confused–most often i.e. going in place of e.g. erroneously. Only one of the two phrases actually contains the root for “example.” If you’re fishing for the right phrase to use in order to provide an example, e.g. is the way to go.