Here's how it works:
1. Organism trapped: An organism, like a leaf, shell, or bone, gets buried in soft sediment (like mud or sand).
2. Sediment hardens: Over time, the sediment hardens into rock, trapping the organism within.
3. Organism decays: The organism's soft tissues decompose, leaving behind an empty space within the rock.
4. Mold forms: This empty space is the mold, a negative impression of the organism's shape.
Note: A mold fossil is an imprint, not the actual organism itself. To get the actual shape, a cast fossil is formed when minerals fill in the mold, creating a three-dimensional replica of the original organism.