Butter comes in two forms salted and unsalted. Salt is added to butter for flavor and as a preservative so it will have a longer shelf life. However, salt can overpower the sweet flavor of the butter and can also mask any odors. Salted butter also contains higher water content. Also, the amount of salt added to salted butter varies from manufacturer to manufacturer and it is hard to know how much extra salt to add to your recipe.
Unsalted butter has a short shelf life because it contains no preservatives.
Most butter has an expiry date on it. However, if you buy unsalted butter and do not use it right away, it is best to freeze it. You can freeze butter for around six months if it is well wrapped so that it will not pick up odors. Just make sure you defrost the butter overnight in the refrigerator before using it. Never use whipped butter in baking as it has air whipped into it that changes the volume of the butter.