Most people think scientists count tree rings or look at the fossil itself — actually, they measure the decay of radioactive atoms trapped in the rock surrounding the fossil. The age of the fossil is determined by the age of the rock layer it sits in, not the bone itself.
Rocks contain radioactive isotopes like potassium-40, uranium-238, and carbon-14. These atoms decay at a predictable, constant rate — like a cosmic clock. Scientists measure how much of the original isotope remains versus how much has decayed into a stable form. From this ratio, they calculate how long the decay has been happening, which tells them the rock's age.
Why this works: When molten rock cools and solidifies, the radioactive "clock" starts at zero. The fossil trapped inside tells you the rock formed around the time the organism died.
Dinosaur bones themselves are not usually radiometrically dated — the bones have been chemically replaced with minerals over time, and those minerals do not contain measurable radioactive atoms from when the dinosaur died. Instead, scientists date the volcanic ash layer or lava flow that sits directly above or below the fossil. If a T-rex skeleton is sandwiched between two layers of volcanic rock, the bottom layer's age tells you the minimum age, and the top layer tells you the maximum age.
Scientists also use biostratigraphy — comparing the fossil to other fossils in the same rock layer. If the dinosaur sits alongside ammonites or other organisms with known ages, that narrows the range. Multiple dating methods on multiple rocks around the same fossil almost always agree, which is why we can say with confidence that T-rex went extinct 66 million years ago, not 50 million or 100 million.
Pro tip: The oldest precisely dated dinosaur fossils come from volcanic ash layers that entombed them instantly — like Pompeii. Fossils found in regular sedimentary rock (sandstone, mudstone) are harder to date precisely, so scientists use ranges ("between 80 and 85 million years ago") rather than exact numbers.