Summarize this article in one sentence.
Before submerging the hat in water, you need to see if the dye will run. Dip a white cloth in warm water and rub it on a small, inconspicuous area of the hat. If the dye comes off on the rag, don’t wash or submerge the hat. If it doesn’t, the item is colorfast and can be washed. Buy a new hat instead of trying to wash one that isn’t colorfast; the hat will likely be ruined if you do try to wash it. Put the soap in the bottom of the bucket or sink and allow it to fill up with warm water. Agitate the water to make bubbles. Avoid using a detergent containing bleach or a bleach alternative, which could fade the color of the hat. Before placing the hat in the water, you should pre-treat the stain. Spray a stain treatment product directly onto the fabric, concentrating on the areas that soak up the most sweat, like the interior band. Dip the hat in the sink or bucket and swirl it around several times. Then, let it soak in the water for a few hours to allow the soap to break down the sweat and oil in the fabric. You can stir the water or swirl the hat around every hour or so, if desired. Remove the hat from the bucket or drain the water from the sink. Use cold, running water to rinse the sweat and soap from the hat. Continue rinsing until the water runs clear and there are no more bubbles. Gently squeeze out the excess water, taking care not to ruin the shape of the hat. Roll up a small towel and place it inside the hat. Reshape the bill, if applicable. Then, place the hat near a fan or open window so it gets as much air flow as possible. Let it dry fully before wearing it again, which could take up to 24 hours. Avoid letting the hat dry in direct sunlight, which could fade the color. Don’t dry the hat in the clothes dryer either, which may shrink or damage the hat.

Summary:
Find out if the fabric is colorfast. Fill a  bucket with warm water and 1 US tbsp (15 ml) of laundry detergent. Spray a stain treatment product on the hat to loosen sweat and grime. Let the hat soak in the soapy water for up to 4 hours. Rinse the hat thoroughly with cold water. Stuff the hat with a towel and allow it to air dry.