Opened commercial mayonnaise can generally stay good for about two months in the refrigerator when stored at around 40°F (4°C) or colder. Using clean utensils also helps prevent contamination and keeps it fresh longer.
Homemade mayonnaise has a much shorter shelf life because it usually contains fresh or raw eggs and no commercial preservatives. It should normally be eaten within about three to seven days and refrigerated immediately after making it.
If mayo develops a sour or unusual smell, discoloration, mold, or major separation, it is safer to throw it away. Proper refrigeration and keeping the container clean are the best ways to make mayonnaise last safely.