Stye usually occurs as a result of inflammation and poor oil flow in the oil glands around the eyelid margin.
There are 2 main approaches to treating styes.
Performing warm compress twice a day for 10 to 15 minutes often helps soften the contents in the stye, resulting in gradual resolution of the style. In addition, maintaining lid hygiene by cleaning it with mild soapy solutions or lid wipes helps reduce risks of infection.
You may however want to consider incision and drainage of the stye when there is little relief after 2 to 3 weeks of the above mentioned approaches. A visit to an ophthalmologist is strongly recommended if there is pain as it may indicate the presence of an infection. Recurrence is common; a visit to an ophthalmologist to exclude other serious causes such as eyelid tumour is recommended for peace of mind.
One could continue to maintain regular lid hygiene and warm compress even after the stye has resolved as a form of preventative measure.