In the predynastic era, the dead were wrapped in matting or goatskin and placed in a shallow oval pit dug in the sand. Food and drink in pottery vessels were left for the journey in the hereafter. Sand or rubble was heaped on top of the grave to form a small mound. Later, tombs of the elite consisted of underground rectangular structures with one or more compartments. These were sometimes lined with brick to support the sides and were covered with heaps of rubble. Some were built with a staircase for easier access to the underground chambers.
The mastaba, a huge rectangular structure over an underground chamber, became the preferred burial structure for nobility in the Second Dynasty. Mastaba is an Arabic word meaning "bench." Its outer walls were built straight but leaning slightly inward. Mastabas often had rooms for offerings decorated with reliefs and inscriptions. Around that time, the ancient Egyptians began to place the deceased in a sarcophagus or coffin.
In the Third Dynasty, the architectural genius Imhotep began a revolution in funerary architecture by building a mortuary complex for King Djoser of stone instead of brick and timber. The flat-topped mastaba evolved into a step pyramid as six rectangles of decreasing area were built one on top of the other. With the construction of the pyramid of King Senefru at Meidum, the step pyramid evolved into the true pyramid, with straight, flat sides angled to the top. Senefru's son, Khufu, built the Great Pyramid at Giza. Khafra built the next largest pyramid as well as the Sphinx, and his son, Menkaure, built the third great pyramid at Giza. By the end of the Old Kingdom, Giza had become a city of the dead with streets lined with small pyramids for queens and princesses and tombs for favored nobles.
Pyramids were part of a pyramid complex that contained the pyramid, a valley temple with a causeway leading to the pyramid temple, and a small pyramid. The pyramids contained increasingly complicated systems of chambers and locking devices to prevent the tombs from being robbed.
During the Middle Kingdom, funerary architecture changed as Montuhotep the First built a huge temple in front of the cliffs across the river from Thebes. A tunnel under the temple's huge courtyard led to the tomb hidden deep in the cliffs. Many officials were buried together in vast galleries in Thebes. In the north, royalty were buried under small pyramids with their court buried in tombs around them. By the New Kingdom, rulers attempted to hide their tombs from robbers. Tuthmosis the First built a great underground cave in a small valley across the river from Thebes. After his death, the entrance was sealed and those involved in the construction and burial were sworn to secrecy. Because successive generations were also buried in what is now called the Valley of the Kings, the secret got out and most of the tombs, except for that of Tutankhamun, were plundered.
During the Greco-Roman era, some Greek and Roman burial customs were combined with ancient Egyptian traditions. The elite were buried in small chapels and the ordinary people were commonly buried together. Graves were marked with tombstones, some with mixed Greek and Egyptian depictions and text. Mummification remained popular and objects for daily use were still left in the grave. Egyptian mummy masks were replaced by the Greek-style painted mummy portraits, the most well known from Faiyum.
During the Islamic era, rulers and the elite were buried in tombs within mosques, mausoleums, or great funerary complexes. Under al-Nasir Muhammad, the amirs began to build religious and funerary structures in the area called the Northern Cemetery, on the eastern desert boundary of the old city of al-Qahira. The complex of Sultan Barsbay was built here and contains a madrassa, or school, and a khanqa, or hospice, as well as three mausoleums including his own.