The Lord of the Rings spans approximately 20 years in total. The story begins with Bilbo Baggins’ 111th birthday party, which is also the day he leaves the Shire. The main events of the trilogy, however, take place over a much shorter period.
From the time Frodo Baggins inherits the One Ring until the destruction of the Ring in Mount Doom, about 17 years pass. The journey from the Shire to Mordor, which is the central focus of the story, takes place over roughly a year. This includes the formation of the Fellowship, their travels, battles, and the eventual destruction of the Ring.
In summary, while the entire timeline of The Lord of the Rings covers around 20 years, the main events of the trilogy occur over a much shorter span, primarily focusing on the year-long journey to destroy the Ring.