Hand wash, never the machine. A washed-cotton cap loses its shape fast in a washing machine or dishwasher — the drum warps the crown and buckles the peak. Instead, work a little mild detergent into the sweatband and any marks with a soft brush or cloth, in cool water, and rinse it clear by hand.
Reshape wet and air dry. Press the water out gently without wringing, then pull the cap back into shape and dry it over something round — a bowl or a balled-up towel holds the crown while it dries. Keep it out of direct heat and strong sun, both of which fade the dye and can shrink the panels.
Spot-clean between washes. Most of what a cap needs is a quick go at the sweatband and brim with a damp cloth; a full wash is rarely necessary and always a small risk to the shape, so save it for when the cap genuinely calls for it.
Store it with its shape. Rest the cap on a shelf or a hook rather than crushing it into a bag, and it keeps the crown and peak it came with through years of summers.