

A cell wall is the outer part of a cell in plants, bacteria, fungi, algae, and some archaea. Cell walls protect cells from damage. They also help keep the cell's shape, and control the growth of the cell and the organism it is part of.
The cell wall is tough and usually flexible, but sometimes fairly rigid. It is outside the cell membrane. Besides giving cells support and protection, cell walls act as filters. The cell wall also acts as a pressure vessel, preventing over-expansion when water enters the cell by osmosis. Cells of other living things, such as animals, do not have cell walls, and rely on parts such as the cell membrane for some of these purposes.
The material in the cell wall varies. In plants and algae, the cell wall is made of long molecules of cellulose, pectin, and hemicellulose. The cell wall has channels which let some proteins in and keeps others out. Water and small molecules can go through the cell wall and the cell membrane.
The cell wall has mechanical strength, and supports cell shape. This mechanical strength is its main function:
Although the plant cell wall is strong, it is not rigid or stiff. The flexibility of the cell walls is seen when plants wilt, so that the stems and leaves begin to droop.
Some plants add stiffening material to some of their cell walls. A secondary cell wall is an additional layer of cellulose which increases wall rigidity. More layers may be added containing lignin in xylem cell walls, or containing suberin in cork cell walls. These compounds are rigid and waterproof. They make the secondary wall stiff. Both wood and bark cells of trees have secondary walls. Other parts of plants such as the leaf stalk may get reinforcement to resist the strain of physical forces.
Small molecules, including small proteins, can easily get through the primary plant cell wall. Water and carbon dioxide are distributed throughout the plant. The pH is an important factor in the transport of molecules through cell walls.

Around the outside of the cell membrane is the bacterial cell wall. Bacterial cell walls are made of peptidoglycan, which is made from polysaccharide chains cross-linked by unusual peptides containing D-amino acids. Bacterial cell walls are different from the cell walls of plants and fungi which are made of cellulose and chitin, respectively.
The cell wall of bacteria is also distinct from that of Archaea, which do not contain peptidoglycan. The cell wall is essential to the survival of many bacteria. The antibiotic penicillin is able to kill bacteria by preventing the cross-linking of peptidoglycan and this causes the cell wall to weaken and lyse. The lysozyme enzyme can also damage bacterial cell walls.
The middle lamella gives the cell shape, support, and strength. It is made of calcium and magnesium. Even though it is called middle lanella, it is the outer part of the cell. The middle lamella is the first wall of the cell to give protection.