The age of the earth is based primarily on calculations of the half life of Uranium.. the half life of Uranium is about 4.5 billion years. There are samples of Uranium that are half lead the daughter element and half Uranium. This indicates that one half life of the Uranium has passed. One Half life of Uranium would be 4.5 billion years.
These calculations are based on the assumption that the original pieces of Uranium was 100% Uranium and that no lead was present when the mineral was formed. It also assumes that no Uranium has been lost due to erosion in the 4.5 billion years that the mineral is thought to have existed.
Both of the assumptions of 100% Uranium and no erosion are of course subject to error but the calculations based on these assumptions gives an estimated age of the earth of 4.5 billion years.