Cephalexin is used to treat certain infections caused by bacteria such as pneumonia and other respiratory tract infections; and infections of the bone, skin, ears, , genital, and urinary tract. Cephalexin is in a class of medications called cephalosporin antibiotics. It works by killing bacteria.
Antibiotics such as cephalexin will not work for colds, flu, or other viral infections. Using antibiotics when they are not needed increases your risk of getting an infection later that resists antibiotic treatment.