Fossils are formed in different ways, but most are made when a plant or animal dies in a watery environment and is buried in mud. The soft tissues quickly decompose leaving the hard bones or shells behind. Over time sediment builds over the top and hardens into rock.