Formalin works by forming cross-links between amino acids in proteins, particularly lysine residues. This process, known as cross-linking, stabilizes the tissue and prevents it from decaying. The cross-links also render the proteins insoluble, which helps in maintaining the structural integrity of the tissue during subsequent processing and staining.