The best way to clean your hat is to wash it in the top rack of your dishwasher. Our friends over at Lids recommend the Ball Cap Buddy for this, which helps protect your hat's shape while it's in the wash. Once the wash cycle has finished, remove your hat and let it air dry. While it dries and if you do not have a Ball Cap Buddy, a rolled up towel can work to help the hat keep its shape.
Be sure not to use dish washing detergent and keep an eye on the water temperature, considering hot water can shrink your hat.
If it's a knit hat, we recommend putting the hat in a pillowcase of similar color and putting it in the wash with cold water. Make sure to let it air dry instead of throwing it in the dryer. You can also wash it by hand in cold water.