Ketoconazole is used to treat certain serious fungal infections in the body. Ketoconazole belongs to the class of drugs called azole antifungals. It works by stopping the growth of the fungus. Ketoconazole should not be used to treat fungal infections on the skin and nails due to the risk of serious side effects and drug interactions.