The eyelids, both upper and lower, contain a number of sebaceous glands which secrete oil to keep the eye from drying and also keep the eyelashes healthy too. Due to the amount that we rub our eyes without properly washing our hands these glands often get blocked or infected with bacteria and this gives rise to a condition known as an eye sty.
An eye sty will usually begin with a painful spot above or below the eye. There may be a dull pain when you blink or even just when you touch it, although this should be avoided. Later the pain might become visible as a swelling which may feel warm to the touch and appear red. Left untreated a sty can become very painful and look like a spot (yellow or white and as though it may burst) but luckily there are plenty of treatments to stop it getting to this stage.
At the first signs of an eye sty developing you should get a cotton wool pad or ball, soak it in hot water and wait for it to cool enough to place on your eye (but so it is still warm). The warm water draws the impurities out of the sebaceous gland and allows it to stop swelling. Sometimes the sty is due to a blockage and heat can help to drain whatever is causing it. You should keep applying the warm water for 15 minutes, about every two to three waking hours. Before bed and upon waking you can also use a non-irritant soap or even shampoo on the eye by closing it and simply rubbing it with your finger and some warm water. This helps to keep the area clean but you should make sure you don't get the soap on your actual eyeball too much.
Your secondary aim for eye sty treatment should be to keep the area as clean as possible. This means washing your hands regularly, using a clean towel to dry your face, stopping the application of makeup and stopping using contact lenses until it has cleared up. Also, while it might be very tempting to squeeze the impurities out of the sty you can do a lot more damage if the pus is squeezed the wrong way and it goes further under the skin.
For stys that don't go away with standard home treatment a doctor or ophthalmologist can drain the gland quite easily if you make an appointment. It can be a little painful but relief is almost instant as the specialist makes a small cut and drains the pus hygienically. Before it gets to that stage, however, a course of antibiotics will often help to kill off the bacteria causing the infection and blockage so that they cannot multiply any more.
An eye sty is unpleasant as it appears quite visible and going out in public with a particularly bad sty is often undesirable. The rule of thumb here should be to use warm compresses for 15 minutes, every two to three hours as soon as you feel even the slightest twinge of pain as this will prevent it from developing any further.