White socks can become dirty and yellowish over time.
However, there are a few things you can try to get them back to their original white glory.
Bleach
Add a small amount of bleach to a container of warm water and soak the socks for 15-20 minutes.

Then wash the socks as usual.
Baking Soda and Vinegar
Add a cup of baking soda to a bucket of warm water and soak the socks for 30-40 minutes.
Then add 50-100 g of white vinegar to the water and soak for another hour.
After soaking, wash the socks as usual.
Hydrogen peroxide
Mix equal parts hydrogen peroxide and water in a container and soak the socks for about 30 minutes.
Then rinse the socks or continue washing as usual.
Stain remover
Apply stain remover directly to the soiled areas of the socks.
Leave them for a few minutes before continuing with the wash.