Megatron was ultimately reformatted into Galvatron.
In the Transformers universe, Megatron is the leader of the Decepticons and a primary antagonist. His fate varies across different continuities within the franchise. In the original 1984 animated series, during the 1986 animated film “The Transformers: The Movie,” Megatron is severely injured in a battle against Optimus Prime. His damaged body is then cast out into space by his treacherous second-in-command, Starscream.
While drifting through space, Megatron is encountered by Unicron, a planet-sized Transformer who offers him a new body and new troops in exchange for destroying the Autobot Matrix of Leadership, which is the only thing that can threaten Unicron. Agreeing to the terms, Megatron is reformatted into a more powerful being named Galvatron. As Galvatron, he is more powerful and even more ruthless than he was as Megatron.
In other continuities, such as the live-action film series directed by Michael Bay, Megatron undergoes several transformations and rebirths. In the first film, he is frozen in ice for centuries before being reawakened. He is killed in the second film, “Transformers: Revenge of the Fallen,” but is resurrected in the third film, “Transformers: Dark of the Moon,” where he meets his end once again. However, his consciousness persists, and he is reborn as Galvatron in the fourth film, “Transformers: Age of Extinction,” through human engineering.
The concept of Megatron being reborn or reformatted into Galvatron is a common theme in the Transformers lore, symbolizing his persistence and the cyclical nature of his conflict with the Autobots.