If you’ve noticed some pain, swelling, itching, or redness in your eye, you likely have an eye infection. Eye infections fall into three specific categories based on their cause: viral, bacterial, or fungal, and each is treated differently.

The good news is eye infections aren’t hard to spot, so you can seek treatment quickly.

Here’s everything you need to know about the eight most common eye infections so you can figure out the cause and what to do about it.

Infectious conjunctivitis, or pink eye, is one of the most common eye infections. It happens when blood vessels in the conjunctiva, the thin outermost membrane surrounding your eyeball, become infected by bacteria or a virus.

As a result, your eyes become pink or red, and inflamed.

It can also result from allergies or exposure to chemicals, like chlorine, in swimming pools.

Conjunctivitis caused by bacteria or virus is extremely contagious. You can still spread it up to two weeks after the infection starts. Take note of any of the following symptoms and see your doctor as soon as possible for treatment:

  • reddish or pinkish tint to your eyes
  • watery discharge from your eyes that’s thickest when you wake up
  • itchiness or feeling like there’s something constantly in your eyes
  • producing more tears than usual, especially in only one eye

You’ll likely need the following treatments depending on which type of conjunctivitis you have:

  • Bacterial: Antibiotic eye drops, ointments, or oral medications to help kill bacteria in your eyes. After starting antibiotics, symptoms fade in a couple of days.
  • Viral: No treatment exists. Symptoms tend to fade after 7 to 10 days. Apply a clean, warm, wet cloth to your eyes to relieve discomfort, wash hands frequently, and avoid contact with others.
  • Allergic: Over-the-counter (OTC) antihistamines like diphenhydramine (Benadryl) or loratadine (Claritin) help relieve allergy symptoms. Antihistamines can be taken as eye drops, and anti-inflammatory eye drops can also help with symptoms.

Infectious keratitis happens when your cornea gets infected. The cornea is the clear layer that covers your pupil and iris. Keratitis results from either an infection (bacterial, viral, fungal, or parasitic) or an eye injury. Keratitis means swelling of the cornea and isn’t always infectious.

Symptoms of keratitis can include:

  • redness and swelling in your eye
  • eye pain or discomfort
  • producing more tears than usual or an abnormal discharge
  • pain or discomfort when you open and close your eyelids
  • loss of some vision or blurry vision
  • light sensitivity
  • sensation of having something stuck in your eye

You’re more likely to develop keratitis if:

  • you wear contact lenses
  • your immune system is weak from another condition or illness
  • you live somewhere that’s humid and warm
  • you use corticosteroid eyedrops for an existing eye condition
  • your eye is injured, especially by plants with chemicals that can get into your eye

See your doctor as soon as possible to stop the infection if you notice any keratitis symptoms. Some treatments for keratitis include:

  • Bacterial. Antibacterial eye drops can usually clear up a keratitis infection in a few days. Oral antibiotics are typically used to treat more severe infections.
  • Fungal. You’ll need antifungal eye drops or medication to kill the fungal organisms causing your keratitis. This can take weeks to months.
  • Viral. There’s no way to eliminate a virus. Oral antiviral medications or eyedrops can help stop the infection in a few days up to a week. Viral keratitis symptoms may later return even with treatment.

Endophthalmitis is severe inflammation of the inside of your eye resulting from a bacterial or fungal infection. Candida fungal infections are the most common cause of endophthalmitis.

This condition can happen after certain eye surgeries, such as cataract surgery, although this is rare. It may also happen after your eye is penetrated by an object. Some symptoms to watch out for, especially after surgery or an eye injury, include:

  • mild to severe eye pain
  • partial or complete vision loss
  • blurry vision
  • redness or swelling around the eye and eyelids
  • eye pus or discharge
  • sensitivity to bright lights

Treatment depends on what causes the infection and how severe it is.

First, you’ll need antibiotics injected directly into your eye with a special needle to help stop the infection. You may also receive a corticosteroid shot to relieve inflammation.

If something has gotten into your eye and caused the infection, you’ll need to get it removed right away. Seek emergency medical attention in these cases — never try to remove an object from your eye by yourself.

After antibiotics and object removal, your symptoms can begin to get better in a few days.

Blepharitis is an inflammation of your eyelids, the skin folds covering your eyes. This type of inflammation is usually caused by clogging of the oil glands inside the eyelid skin at the base of your eyelashes. Blepharitis may be caused by bacteria.

Symptoms of blepharitis include:

  • eye or eyelid redness, itchiness, swelling
  • eyelid oiliness
  • sensation of burning in your eyes
  • feeling like something’s stuck in your eyes
  • sensitivity to light
  • producing more tears than usual
  • crustiness on your eyelashes or corners of your eyes

You’re more likely to develop blepharitis if you:

  • have scalp or eyebrow dandruff
  • are allergic to your eye or face makeup
  • have oil glands that don’t work properly
  • have lice or mites on your eyelashes
  • take certain medications that affect your immune system

Treatments for blepharitis include:

  • cleaning your eyelids with clean water and applying a warm, wet, clean towel to your eyelids to relieve swelling
  • using corticosteroid eye drops or ointments to help with inflammation
  • using lubricating eye drops to moisten your eyes and prevent irritation from dryness
  • taking antibiotics as oral medications, eye drops, or ointments applied to your eyelids

A sty (also called a hordeolum) is a pimple-like bump that develops from an oil gland on the outer edges of your eyelids. These glands can get clogged with dead skin, oils, and other matter and allow bacteria to overgrow in your gland. The resulting infection causes a sty.

Sty symptoms include:

  • pain or tenderness
  • itchiness or irritation
  • swelling
  • producing more tears than usual
  • crustiness around your eyelids
  • increased tear production

Some treatments for sties include:

  • applying a clean, warm, damp cloth to your eyelids for 20 minutes at a time a few times a day
  • using mild, scent-free soap and water to clean your eyelids
  • taking over-the-counter (OTC) pain relievers, such as acetaminophen (Tylenol), to help with pain and swelling
  • stopping use of contact lenses or eye makeup until the infection goes away
  • using antibiotic ointments to help kill the infectious overgrowth

See your doctor if the pain or swelling gets worse, even with treatment. A sty should disappear in about 7 to 10 days. If it doesn’t, ask your doctor about other possible treatments.

Uveitis happens when your uvea gets inflamed from infection. The uvea is the central layer of your eyeball that transports blood to your retina — the part of your eye that transmits images to your brain.

Uveitis often results from immune system conditions, viral infections, or eye injuries. Uveitis doesn’t usually cause any long-term problems, but you can lose vision if a severe case isn’t treated.

Uveitis symptoms can include:

  • eye redness
  • pain
  • “floaters” in your visual field
  • sensitivity to light
  • blurry vision

Treatment for uveitis may include:

  • wearing darkened glasses
  • eye drops that open up your pupil to relieve pain
  • corticosteroid eye drops or oral steroids that relieve inflammation
  • eye injections to treat symptoms
  • oral antibiotics for infections that have spread beyond your eye
  • medications that subdue your immune system (severe cases)

Uveitis usually starts to improve after a few days of treatment. Types that affect the back of your eye, called posterior uveitis, may take longer — up to several months if it’s caused by an underlying condition.

Eyelid cellulitis, or periorbital cellulitis, happens when eye tissues get infected. It’s often caused by an injury like a scratch to your eye tissues that introduces infectious bacteria, such as Staphylococcus (staph), or from bacterial infections of nearby structures, such as sinus infections.

Young children are more likely to get cellulitis because they’re at higher risk of infection due to the type of bacteria that causes this condition.

Cellulitis symptoms include eyelid redness and swelling as well as eye skin swelling. You typically won’t have any eye pain or discomfort.

Treatment for cellulitis may include:

  • applying a warm, damp, clean towel to your eye for 20 minutes at a time to relieve inflammation
  • taking oral antibiotics, such as amoxicillin, or IV antibiotics for children under 4
  • getting surgery to relieve pressure within your eye if the infection becomes very severe (this rarely happens)

Ocular herpes happens when your eye is infected by the herpes simplex virus (HSV-1). It’s often just called eye herpes.

Eye herpes is spread by contact with someone who has an active HSV-1 infection, not through sexual contact (that’s HSV-2). Symptoms tend to infect one eye at a time, and include:

  • eye pain and irritation of the eye
  • sensitivity to light
  • blurry vision
  • eye tissue or corneal tears
  • thick, watery discharge
  • eyelid inflammation

Symptoms may go away on their own without treatment after 7 to 10 days, up to a few weeks.

Treatment may include:

  • antiviral medication, such as acyclovir (Zovirax), as eye drops, oral medications, or topical ointments
  • debridement, or brushing off your cornea with cotton to get rid of infected cells
  • corticosteroid eye drops to relieve inflammation if infection spreads further into your eye (the stroma)

Do the following to help prevent eye infections or keep viral infections from recurring:

  • Don’t touch your eyes or face with dirty hands.
  • Bathe regularly and wash your hands frequently.
  • Follow an anti-inflammatory diet.
  • Use clean towels and tissues on your eyes.
  • Don’t share eye and face makeup with anyone.
  • Wash your bedsheets and pillowcases at least once a week.
  • Wear contact lenses well-fitted to your eye and see your eye doctor regularly to have them checked.
  • Use contact solution to disinfect lenses every day.
  • Don’t touch anyone who has conjunctivitis.
  • Replace any object that’s been in contact with an infected eye.

Eye infection symptoms often go away on their own in a few days.

But seek emergency medical attention if you have severe symptoms. Pain or loss of vision should prompt a visit to your doctor.

The earlier an infection is treated, the less likely you are to experience any complications.