Gram stain or Gram staining, also called Gram's method, is a method of staining used to distinguish and classify bacterial species into two large groups (gram-positive and gram-negative)
Gram staining differentiates bacteria by the chemical and physical properties of their cell walls by detecting peptidoglycan, which is present in the cell wall of Gram-positive bacteria.
Gram-negative cells also contain peptidoglycan, but a very small layer of it is dissolved when the alcohol is added. This is why the cell loses its initial color from the primary stain.
Gram-positive bacteria retain the crystal violet dye, and thus are stained violet, while the Gram-negative bacteria do not; after washing, a counterstain is added (commonly safranin or fuchsine) that will stain these Gram-negative bacteria a pink color.