In the 19th century, geologists could tell whether one rock layer was older or younger than another by the fossils they contained. But they could not measure the absolute ages of rocks until after the discovery of radioactivity in the 1890s.
Radioactive substances, which are occasionally found in rocks, give off high-energy rays and decay (break down) at a fixed rate. For instance, as the radioactive element uranium decays, it changes into lead. If you measure the amount of lead in a uranium sample, you can then work out its age. The uranium-lead method is used for extremely old rocks.
For substances up to 50,000 years old, scientists use carbon-14 dating. Carbon-14 is a radioactive element that is present in all living things. When organisms die, the carbon-14 in the tissues decays. Half of the scientists can work out the ages of old bones or logs.