Some put it in their washing machine & others use bleach...
The way I do it.....
I clean mine every week. I take it outside & use the garden hose to blast away most of the brown stains, I believe organic matter. I first do it inside out (where the water goes in first), then the other way. You will still see brown stain still all over the sock.
Over night soaking:
Now, I get a bucket & fill it with water & add hydrogen peroxide. The peroxide i added right on the sock (reverse side/inside out) You can use the peroxide they sell over the counter but it's not as strong, but work just take maybe a full day.
I use 28% peroxide since I am able to get when i need it. Anyway, when the peroxide hits the sock it turns white, if you still see brown on it I just leave it over night. Next day, i rinse it with water very well & hang it outside to dry. When I change socks, I bring it in & when when i dosing the aquarium after cleaning it, i put it in a bucket with prime for extra measure.