Cefalexin is a β-lactam antibiotic of the cephalosporin family.  It is bactericidal and acts by inhibiting synthesis of the peptidoglycan layer of the bacterial cell wall. As cefalexin closely resembles d-alanyl-d-alanine, an amino acid ending on the peptidoglycan layer of the cell wall, it is able to irreversibly bind to the active site of PBP, which is essential for the synthesis of the cell wall. It is most active against gram-positive cocci, and has moderate activity against some gram-negative bacilli. However, some bacterial cells have the enzyme β-lactamase, which hydrolyzes the β-lactam ring, rendering the drug inactive. This contributes to antibacterial resistance towards cefalexin.