Scientists combine several well-tested techniques to find out the ages of fossils. The most important are Relative Dating, in which fossils and layers of rock are placed in order from older to younger, and Radiometric Dating, which allows the actual ages of certain types of rock to be calculated.
Relative Dating. Fossils are found in sedimentary rocks that formed when eroded sediments piled up in low-lying places such as river flood plains, lake bottoms or ocean floors. Sedimentary rock typically is layered, with the layers derived from different periods of sediment accumulation. Almost any place where the forces of erosion - or road crews - have carved through sedimentary rock is a good place to look for rock layers stacked up in the exposed rock face.
When you look at a layer cake, you know that the layer at the bottom was the first one the baker put on the plate, and the upper ones were added later. In the same way, geologists figure out the relative ages of fossils and sedimentary rock layers; rock layers, and the fossils they contain, toward the bottom of a stack of sediments are older than those found higher in the stack.
Radiometric Dating. Until the middle of the last century, "older" or "younger" was the best scientists could do when assigning ages to fossils. There was no way to calculate an "absolute" age (in years) for any fossil or rock layer. But after scientists learned that the nuclear decay of radioactive elements takes place at a predictable rate, they realized that the traces of radioactive elements present in certain types of rock, such as hardened lava and tuff (formed from compacted volcanic ash), could be analyzed chemically to determine the ages, in years, of those rocks.
Putting Relative and Radiometric Dating Together. Once it was possible to measure the ages of volcanic layers in a stack of sedimentary rock, the entire sequence could be pinned to the absolute time scale. In the Wyoming landscape shown below left, for example, the gray ash layer was found to be 73 million years old. This means that fossils in rock layers below the tuff are older than 73 million years, and those above the tuff are younger. Fossils found embedded within the ash, including the fossil leaves shown below right, are the same age as the ash: 73 million years old.