The stain is retained by the peptidoglycan layer within the cell wall of the bacteria. They are classified into gram positive and gram negative. Gram positive has a thick layer of peptidoglycan, that prevents the stain from washing away. Gram negative on the other hand, has a thin layer of peptidoglycan.