The mosque is located adjacent to the Walled City of Lahore, Pakistan. The entrance to the mosque lies on the western side of the rectangular Hazuri Bagh, and faces towards the famous Alamgiri Gate of the Lahore Fort, which is located on the eastern side of the Hazuri Bagh. The mosque is also located next to the Roshnai Gate, one of the original thirteen gates of Lahore, which is located on the southern side of the Hazuri Bagh.
Near the entrance of the mosque lies the Tomb of Muhammad Iqbal, a poet widely revered in Pakistan as the founder of the Pakistan Movement which led to the creation of Pakistan as a homeland for the Muslims of British India. Also located near the mosque's entrance is the tomb of Sir Sikandar Hayat Khan, who is credited for playing a major role in preservation and restoration of the mosque.
Lahore was considered a strategic center as it protected the empire from potential invaders from the west. The city was made an imperial capital by the earlier Emperor, Akbar, who established the nearby Lahore Fort.
The sixth Mughal emperor, Aurangzeb, chose Lahore for as the site for his new imperial mosque. Aurangzeb, unlike the previous emperors, was not a major patron of art and architecture and instead focused much of his reign on various military conquests, which added over 3 million square kilometres to the Mughal realm.
The mosque was built to commemorate military campaigns against the Maratha king Shivaji Bhonsle, although construction of the mosque exhausted the Mughal treasury and weakened the Mughal state. As a symbol of the mosque's importance, it was built directly across from the Lahore Fort and its Alamgiri Gate, which was concurrently built by Aurangzeb during construction of the mosque.
The mosque's was commissioned by the Mughal Emperor Aurangzeb in 1671, with construction overseen by the Emperor's foster brother, and Governor of Lahore, Muzaffar Hussein - also known by the name Fidai Khan Koka. Aurangzeb had the mosque built in order to commemorate his military campaigns against the Maratha leader Shivaji Bhonsle. After only two years of construction, the mosque was opened in 1673.
On 7 July 1799, the Sikh army of Ranjit Singh took control of Lahore.
In 1849 the British seized control of Lahore from the Sikh Empire. During the British Raj, the mosque and the adjoining fort continued to be used as a military garrison. The 80 cells built into the walls surrounding the its vast courtyard were demolished by the British after the Freedom Fight of 1857, so as to prevent them from being used for anti-British activities. The cells were replaced by open arcades known as dalans.
Because of increasing Muslim resentment against the use of the mosque as a military garrison, the British set up the Badshahi Mosque Authority in 1852 to oversee the restoration and to re-establish it as a place of religious worship. From then onwards, piecemeal repairs were carried out under the supervision of the Badshahi Mosque Authority. The building was officially handed back to the Muslim community by John Lawrence, who was the Viceroy of India. The building was then re-established as a mosque.
In April 1919, after the Amritsar Massacre, a mixed Hindu-Muslim crowd of an estimated 25,000-35,000 gathered in the mosque's courtyard in protest. A speech by Gandhi was read at the event by Khalifa Shuja-ud-Din, who would later become Speaker of the Provincial Assembly of the Punjab.
Extensive repairs commenced from 1939 onwards, when Sikandar Hayat Khan began raising funds for this purpose. Renovation was supervised by supervised by the architect Nawab Alam Yar Jung Bahadur. As Khan was largely credited for extensive restorations to the mosque, he was buried adjacent to the mosque in the Hazuri Bagh.
Restoration works begun in 1939 continued after the Independence of Pakistan, and were completed in 1960 at a total cost of 4.8 million Rupees.
On the occasion of the 2nd Islamic Summit held at Lahore on 22 February 1974, thirty-nine heads of Muslim states offered their Friday prayers in the Badshahi Mosque, including, among others, Zulfiqar Ali Bhutto of Pakistan, Faisal of Saudi Arabia, Muammar Gaddafi, Yasser Arafat, and Sabah III Al-Salim Al-Sabah of Kuwait. The prayers were led by Mawlānā Abdul Qadir Azad, the then khatib of the mosque.
In 1993, the Badshahi Mosque in a tentative list as a UNESCO World Heritage Site. In 2000, the marble inlay in the main prayer hall was repaired. In 2008, replacement work on the red sandstone tiles on the mosque's large courtyard was begun using red sandstone imported from the original Mughal source near Jaipur, in the Indian state of Rajasthan.
As a gateway to the west, and Persia in particular, Lahore had a strong regional Style which was heavily influenced by Persian architectural styles. Earlier mosques, such as the Wazir Khan Mosque, were adorned in intricate kashi kari, or Kashan style tile work, from which the Badshahi Mosque would depart. Aurangzeb chose an architectural plan similar to that of Shah Jehan's choice for the Jama Masjid in Delhi, though built the Badshahi mosque on a much larger scale. Both mosques feature red sandstone with white marble inlay, which is a departure from typical mosque design in Lahore, in which decoration is done by means of intricate tile work.
Entrance to the mosque coplex is via a two storey edifice built of red sandstone which is elaborately decorated with framed and carved paneling on each of its facades. The edifice features a muqarna, an architectural feature from the Middle East that was first introduced into Mughal architecture with construction of the nearby and ornate Wazir Khan Mosque.
The mosque's full name "Masjid Abul Zafar Muhy-ud-Din Mohammad Alamgir Badshah Ghazi" is written in inlaid marble above the vaulted entrance. The mosque's gateway faces east towards the Alamgiri Gate of the Lahore Fort, which was also commissioned by Aurangzeb. The massive entrance and mosque are situated on a plinth, which is ascended by a flight of 22 steps at the mosque's main gate which. The gateway itself contains several chambers which are not accessible to the public. One of the rooms is said to contain hairs from the Prophet Muhammad's, and that of his son-in-law Ali.
After passing through the massive gate, an expansive sandstone paved courtyard spreads over an area of 276,000 square feet, and which can accommodate 100,000 worshipers when functioning as an Idgah. The courtyard is enclosed by single-aisled arcades.
The main edifice at the site was also built from red sandstone, and is decorated with white marble inlay. The prayer chamber has a central arched niche with five niches flanking it which are about one third the size of the central niche. The mosque has three marble domes, the largest of which is located in the centre of the mosque, and which is flanked by two smaller domes.
Both the interior and exterior of the mosque are decorated with elaborate white marble carved with a floral design common to Mughal art. The carvings at Badshahi mosque are considered to be uniquely fine and unsurpassed works of Mughal architecture. The chambers on each side of the main chamber contains rooms which were used for religious instruction. The mosque can accommodate 10,000 worshippers in the prayer hall.
At each of the four corners of the mosque, there are octagonal, three storey minarets made of red sandstone that are 196 feet (60 m) tall, with an outer circumference of 67 feet and the inner circumference is eight and half feet. Each Minaret is topped by a marble canopy. The main building of the mosque also features an additional four smaller minarets at each corner of the building.