Stem-loop intramolecular base pairing is a pattern that can occur in single-stranded RNA. The structure is also known as a hairpin or hairpin loop. It occurs when two regions of the same strand, usually complementary in nucleotide sequence when read in opposite directions, base-pair to form a double helix that ends in an unpaired loop. The resulting structure is a key building block of many RNA secondary structures. As an important  secondary structure of RNA, it can direct RNA folding, protect structural stability for messenger RNA (mRNA), provide recognition sites for RNA binding proteins, and serve as a substrate for enzymatic reactions.

Formation and stability
The formation of a stem-loop structure is dependent on the stability of the resulting helix and loop regions. The first prerequisite is the presence of a sequence that can fold back on itself to form a paired double helix. The stability of this helix is determined by its length, the number of mismatches or bulges it contains (a small number are tolerable, especially in a long helix) and the base composition of the paired region. Pairings between guanine and cytosine have three hydrogen bonds and are more stable compared to adenine-uracil pairings, which have only two. In RNA, adenine-uracil pairings featuring two hydrogen bonds are equal to the adenine-thymine bond of the DNA. Base stacking interactions, which align the pi bonds of the bases' aromatic rings in a favorable orientation, also promote helix formation.

The stability of the loop also influences the formation of the stem-loop structure. "Loops" that are fewer than three bases long are sterically impossible and do not form. Large loops with no secondary structure of their own (such as pseudoknot pairing) are also unstable. Optimal loop length tends to be about 4-8 bases long. One common loop with the sequence UUCG is known as the "tetraloop" and is particularly stable due to the base-stacking interactions of its component nucleotides. Therefore, such loops can form on the microsecond time scale.

Structural contexts
Stem-loops occur in pre-microRNA structures and most famously in transfer RNA, which contain three true stem-loops and one stem that meet in a cloverleaf pattern. The anticodon that recognizes a codon during the translation process is located on one of the unpaired loops in the tRNA. Two nested stem-loop structures occur in RNA pseudoknots, where the loop of one structure forms part of the second stem.

Many ribozymes also feature stem-loop structures. The self-cleaving hammerhead ribozyme contains three stem-loops that meet in a central unpaired region where the cleavage site lies. The hammerhead ribozyme's basic secondary structure is required for self-cleavage activity.

Hairpin loops are often elements found within the 5'UTR of prokaryotes.  These structures are often bound by proteins or cause the attenuation of a transcript in order to regulate translation.

The mRNA stem-loop structure forming at the ribosome binding site may control an initiation of translation.

Stem-loop structures are also important in prokaryotic rho-independent transcription termination. The hairpin loop forms in an mRNA strand during transcription and causes the RNA polymerase to become dissociated from the DNA template strand. This process is known as rho-independent or intrinsic termination, and the sequences involved are called terminator sequences.

See also
 Dyad symmetry
 Inverted repeat
 Kissing stem-loop
 Palindromic sequence
 Repeat sequences
 Satellite DNA
 5'UTR

References

RNA
DNA