Using relative dating the fossil is compared to something for which an age is already known.
If the fossil you are trying to date occurs alongside one of these index fossils, then the fossil you are dating must fall into the age range of the index fossil. In a hypothetical example, a rock formation contains fossils of a type of brachiopod known to occur between 410 and 420 million years.
In the science of geology, there are two main ways we use to describe how old a thing is or how long ago an event took place. When you say that I am 38 years old or that the dinosaurs died out 65 million years ago, or that the solar system formed 4.6 billion years ago, those are absolute ages.
There are absolute ages and there are relative ages. We use a variety of laboratory techniques to figure out absolute ages of rocks, often having to do with the known rates of decay of radioactive elements into detectable daughter products.
These isotopes break down at a constant rate over time through radioactive decay.
By measuring the ratio of the amount of the original (parent) isotope to the amount of the (daughter) isotopes that it breaks down into an age can be determined.