Peptidoglycan or murein is a unique large macromolecule, a polysaccharide, consisting of sugars and amino acids that forms a mesh-like peptidoglycan layer (sacculus) that surrounds the bacterial cytoplasmic membrane. The sugar component consists of alternating residues of β-(1,4) linked N-acetylglucosamine (NAG) and N-acetylmuramic acid (NAM). Attached to the N-acetylmuramic acid is an oligopeptide chain made of three to five amino acids. The peptide chain can be cross-linked to the peptide chain of another strand forming the 3D mesh-like layer. Peptidoglycan serves a structural role in the bacterial cell wall, giving structural strength, as well as counteracting the osmotic pressure of the cytoplasm. This repetitive linking results in a dense peptidoglycan layer which is critical for maintaining cell form and withstanding high osmotic pressures, and it is regularly replaced by peptidoglycan production. Peptidoglycan hydrolysis and synthesis are two processes that must occur in order for cells to grow and multiply, a technique carried out in three stages: clipping of current material, insertion of new material, and re-crosslinking of existing material to new material.
The peptidoglycan layer is substantially thicker in Gram-positive bacteria (20 to 80 nanometers) than in Gram-negative bacteria (7 to 8 nanometers). Depending on pH growth conditions, the peptidoglycan forms around 40 to 90% of the cell wall's dry weight of Gram-positive bacteria but only around 10% of Gram-negative strains. Thus, presence of high levels of peptidoglycan is the primary determinant of the characterisation of bacteria as Gram-positive.  In Gram-positive strains, it is important in attachment roles and serotyping purposes. For both Gram-positive and Gram-negative bacteria, particles of approximately 2 nm can pass through the peptidoglycan.
It is difficult to tell whether an organism is gram-positive or gram-negative using a microscope; Gram staining, created by Hans Christian Gram in 1884, is required. The bacteria are stained with several dyes such as crystal violet, iodine alcohol, and safranin. Gram positive cells are purple after staining, while Gram negative cells stain pink.