One of the easiest methods for preventing armpit stains on shirts is to wear an undershirt. This is most helpful when wearing a dress shirt, but sometimes, depending on the style of an article of clothing, wearing an undershirt is not possible. In this case, it is important to focus on antiperspirant use. Antiperspirants, not the sweat itself, are typically the primary cause of underarm stains.
The active sweat-preventing ingredients used in antiperspirants are various aluminum compounds. Sweat is generally colorless and will not leave visible stains on shirts, but the combination of the aluminum compounds and sweat is what starts turning the underarms of light-colored shirts into yellow stains. Choosing an antiperspirant that contains the smallest amount of aluminum helps, as does applying less antiperspirant and letting it fully dry before putting on a shirt. Once a shirt is worn, it is important to wash it immediately and not continue to let sweat and antiperspirant residue build up.
Preventing stains from setting in is easier than attempting to remove them later. According to About Laundry, after noticing that there is yellowing already starting on white shirts, soaking them for 30 minutes in a solution of one part baking soda, one part hydrogen peroxide and one part water, and then scrubbing, will greatly reduce the stains. Also, if possible, air-dry shirts outside; the heat from a dryer will set the stains, making getting rid of them in the future very difficult.