Caspofungin injection is used in adults and children 3 months of age and older to treat yeast infections in the blood, stomach, lungs, and esophagus (tube that connects the throat to the stomach.) and certain fungal infections that could not be treated successfully with other medications. It is also used to treat serious fungal infections in people with a weakened ability to fight infection. Caspofungin injection is in a class of antifungal medications called echinocandins. It works by slowing the growth of fungi that cause infection.