Home cooks often buy dried herbs and spices in jars and leave them in the cupboard ad infinitum, or at least until they run out. While dried herbs and spices do not go bad in the manner of perishable foods, they do have a definite shelf life. After a given amount of time, a spice or herb may completely lose its flavor and aroma, essentially contributing nothing to a dish. Knowing the shelf life of your herbs and spices helps you sidestep this problem.
Each herb and spice has its own specific shelf life, but in general there are some rules of thumb regarding how long they will last in your cupboard. Whole spices that you grind or crush on your own -- like whole nutmeg, cinnamon sticks, cardamom seeds, black peppercorns, fennel seeds, cumin seeds or any in whole rather than powdered form -- will keep the longest, generally for two to five years.
Ground spices sold in powdered form, such as ground cinnamon, turmeric, ground black pepper, paprika and garam marsala, have been exposed to air, which breaks down their aromatic and flavor components. Ground spices will keep in the cupboard for six months to two years. Unless you plan to use them quickly, consider purchasing all the spices you use in whole form and grinding them yourself to keep them fresher longer. It may cost a little more but could prevent you from having to toss ground spices that are past their prime.
Leafy herbs sold in dried form are some of the most familiar names in the spice cupboard -- dried thyme, dried basil, dried rosemary, dried parsley, dried bay leaf and dried sage, for example. These dried herbs last much longer than their fresh counterparts, but they can only stay in the cupboard for three months to two years, depending on the specific herb, before they begin to lose their flavor and aroma due to heat, light, moisture and air exposure.
Dehydrated vegetables are sold in ground form as cupboard spices. Onion powder, garlic powder, chile pepper powder, bell pepper flakes and celery flakes are all examples of this type of dried spice. These have the shortest shelf life of all at around six months.
You can check to see if your spices and herbs are past their prime by shaking the jar with the lid on for a few seconds, then removing the lid and smelling the air around it. If you immediately detect a strong aroma, that spice still has some life left in it. If you struggle to smell it or don't smell anything at all, it's time to replace it.