Flour has a long shelf-life if it is wheat-based. Nowadays, we also have coconut, almond, rice, and other kinds of flour, which are gluten-free. These need more attention when it comes to storage. Most of the time, we tend to overlook its expiry date, although even all-purpose flour might be harmful if stored thoughtless or consumed after its expiry date.
The shelf life of flour depends mainly on its ingredient and the level of processing. The best example is white flour versus whole-wheat flour. The latter contains all the parts of the grain, including the bran and the germ. These two components need to stay away from direct light, moisture, or air because they contain fats. If they get exposed, they have a high chance of spoilage. It applies to all whole-wheat products and some gluten-free flours, such as coconut and almond. White all-purpose flour is highly refined, containing only the starchy endosperm; it is less prone to going bad. 
You can safely store all-purpose flour at room temperature in an airtight container for up to 8 months. If you refrigerate it, you will increase its shelf life by four months; and if you freeze it, you will add one more year. Make sure to store it in an airtight container to prevent exposure to moisture and water. 
As previously mentioned, not all types of flour have a long shelf life, especially the gluten-free varieties. Most of them stay fresh in the pantry for up to two months. If you store them in the fridge, you can keep them between four and six months. And, if you store them in the freezer, they will stay fresh for a year. Make sure to read the storage instructions on the package; some nut flours should be stored only in the fridge or freezer.
If the flour has a bad smell, a different taste, or color, you need to get rid of it. You can still use it even if it has been a couple of months past the expiry date, but make sure it's still fresh. Moldy flour is toxic due to the presence of mycotoxins. These can lead to undesirable symptoms, such as gastrointestinal issues. In conclusion, you shouldn't assume that flour stays fresh for an indefinite period. Even if you might finish a pack in a couple of days, you should still check its condition.
on January 14, 2020