Anakin Skywalker was about 45 years old when he died. He was born in 41 BBY (Before the Battle of Yavin) and died in 4 ABY (After the Battle of Yavin), which places his age at death around 45 years
. This timeline aligns with his age being 9 in Episode I: The Phantom Menace, 19 in Episode II: Attack of the Clones, and 22 in Episode III: Revenge of the Sith, with the original trilogy events occurring roughly 20 years later, culminating in his death in Return of the Jedi at age 45.