Agra Fort was built by Rajput king named Raja Badal Singh who named it Badalgarh Fort. Later, Lodi dynasty built many palaces and mosques inside the fort. It was fully renovated during the Mughal dynasty. The renovation was started by Emperor Akbar. Then Jahangir and Shah Jahan built many other structures inside the fort.
After the attack of Mahmud of Ghazni, Sikandar Lodi made Agra his capital. His son Ibrahim Lodi also made Agra his capital. Ibrahim Lodi was defeated by Babur in the first battle of Panipat in 1526. The Lodi dynasty built many palaces, wells and a mosque.
After defeating Ibrahim Lodi, the first Mughal emperor Babur stayed in the fort. Humayun was sent by his father Babur to Agra and he captured the fort and got a huge treasure which included a big diamond. Humayun called the diamond as Kohinoor. This is the fort where Humayun was crowned as king. He was defeated by Sher Shah Suri in 1540 and the fort was under the Suris till 1555. Humayun defeated Adil Shah Suri son of Sher Shah Suri and again became the emperor.
Hemu captured Agra in 1556 and in the battle of Tughlaqabad. He defeated Tardi Beg Khan the leader of Mughal forces but he was defeated in the second battle of Panipat by Akbar.
Akbar then made Agra his capital and renovated the fort which was ruined. After Akbar, Jahangir and Shah Jahan added many structures to the monument. Gardens, palaces, mosques and other structures were built in the fort. Shah Jahan was imprisoned by his son Aurangzeb in the fort and he died there after eight years.
After the decline of Mughal dynasty, the fort was captured by Marathas who were later defeated by Ahmad Shah Abdali in the third battle of Panipat. A Maratha named Mahadji Shinde again captured the fort in 1785. Later, the British captured the fort and it was under them till independence.
The fort is built in a semi-circular way covering an area of 94 acre. It is built in front of the Yamuna River. The walls of the fort are 70 feet high.
Currently, there are more than two dozen monuments inside the fort though Akbar built around 5,000 monuments according to Abul Fazl out of which most of them are ruined. The monuments built by Akbar have the architecture of Gujarat and Bengal. Shah Jahan has also built white marble palaces and to do this he destroyed some of the monuments. The remaining monuments in the fort are Delhi Gate, Akbari Gate, Bengali Mahal, and others.
Shah Jahan built three mosques inside the fort named Moti Masjid, Mina Masjid, and Nagina Masjid. Besides these, Shah Jahan also built several palaces. In order to give more security to the fort, Aurangzeb built barbicans around two gates.