Trimethoprim/sulfamethoxazole (TMP/SMX) is a combination of two antibiotics: trimethoprim and sulfamethoxazole. It is also known as cotrimoxazole. Its brand names are Bactrim or Septra. TMP/SMX is sold under many other names in different parts of the world.

Antibiotics fight infections caused by bacteria. TMP/SMX is also used to fight infections caused by protozoa and some opportunistic infections (OIs) in people with HIV.


TMP/SMX is used for many bacterial infections. It is effective and inexpensive. Adding TMP/SMX to antiretroviral therapy (ART) reduces death in the first 60 weeks of treatment by 35% according to an African study reported in 2010. Unfortunately, up to one third of the people who take TMP/SMX get an allergic reaction.

Many germs live in our bodies or are common in our surroundings. A healthy immune system can fight them off or keep them under control. However, HIV infection can weaken the immune system. Infections that take advantage of weakened immune defenses are called opportunistic infections (OIs). People with advanced HIV disease can get OIs.

One OI in people with HIV is pneumocystis pneumonia (PCP), which affects the lungs. People who have a CD4 cell count of less than 200 cells/mm3 may develop PCP.

TMP/SMX is the first choice to treat or prevent PCP. If your CD4 cell count is below 200 cells/mm3, ask your healthcare provider if you should be taking TMP/SMX or another drug to prevent PCP.

Another OI is toxoplasmosis (toxo), which affects the brain. People who have a CD4+ cell count of less than 100 may develop toxo. TMP/SMX is sometimes used to treat or prevent cases of toxo.

Some people are allergic to TMP/SMX. Be sure to tell your healthcare provider if you are allergic to sulfa drugs or antibiotics. People who are anemic should not use TMP/SMX. People who are pregnant or breastfeeding should avoid taking TMP/SMX if possible because it may increase the risk of birth defects. Also let your healthcare provider know if you have liver disease, kidney disease, or a shortage of the enzyme glucose-6-phosphate dehydrogenase (G6PD). 


Whenever you take medication, be sure to take all of the prescribed doses. Many people stop if they feel better. This is not a good idea. If the drug doesn’t kill all of the germs, they might change (mutate) so that they can survive even when you are taking medications. When this happens, the drug will stop working. This is called developing resistance to the drug.

For example, if you are taking TMP/SMX to fight PCP and you miss too many doses, the PCP in your body could develop resistance to TMP/SMX. Then you would have to take a different drug or combination of drugs to fight it.


TMP/SMX is available in tablets that contain 80 milligrams (mg) of trimethoprim and 400 mg of sulfamethoxazole. There is also a double strength tablet with 160 mg of trimethoprim and 800 mg of sulfamethoxazole. The dose you take depends on the type of infection you are trying to treat or prevent.

The treatment continues as long as your CD4 cell count is low enough for you to develop toxo or PCP.

TMP/SMX is generally taken with food, but the single-strength tablets can be taken with or without food. Drink plenty of water when taking TMP/SMX.


HIV infection causes higher rates of TMP/SMX side effects. People who have taken TMP/SMX before often have more side effects.

The main side effects of TMP/SMX are nausea, vomiting, loss of appetite, and allergic skin reactions (rashes). The skin rashes can be fairly common. TMP/SMX can cause Stevens-Johnson syndrome, a very serious skin rash.

TMP/SMX can also cause neutropenia, a low level of neutrophils. These are white blood cells (WBCs) that fight bacterial infections. HIV infection can also cause neutropenia.

Some healthcare providers use a desensitization procedure with people who get an allergic reaction. Starting with a very low dose of TMP/SMX that does not cause an allergic reaction, they gradually increase the dose to the full amount. Vitamin C may help in cases of allergic reactions to Bactrim. Another option is to use the drug diaminodiphenyl sulfone (Dapsone).

TMP/SMX can also make you sensitive to sunlight. If this occurs, use sun block on your skin and/or wear sunglasses.

Tell your healthcare provider if your skin gets pale or yellowish, or you get a sore throat, fever, or rash, even after a few weeks of taking TMP/SMX. These might indicate a serious drug reaction.


TMP/SMX is mostly processed by the kidneys. It does not interact very much with drugs that use the liver, including most antiretroviral medications (ARVs) used to treat HIV. However, TMP/SMX interacts with several other types of drugs, including some blood thinners, pills to lower blood sugar, seizure medications, and water pills. Be sure your healthcare provider knows about all the medications you are taking.


TMP/SMX is used to treat PCP and toxoplasmosis, opportunistic infections in people with HIV. It can prevent new infections or treat active infections. If your CD4 cell count is below 200 cells/mm3, talk to your healthcare provider about taking drugs to prevent PCP.


MedlinePlus: Co-trimoxazole

Drugs.com: sulfamethoxazole and trimethoprim

Reviewed March 2021

Print PDF