The Pyramid Texts are the oldest known funerary texts from ancient Egypt, written on the walls of the passages and chambers of a number of Old Kingdom pyramids. The earliest version can be found in the pyramid of Unas at Saqqara (5th Dynasty). The texts were the prerogative of the kings (although they have also been found in the pyramids of the three queens of Pepi II). In later centuries, some of the texts appeared on the coffins of high officials and form part of the so-called Coffin Texts. Even later, a wider section of the population would have access to related texts by means of the Book of the Dead. Some heavily revised sections of the Pyramid Texts appear in temple rituals from the New Kingdom onwards. Pyramid Texts are also known from the Late Period, surviving on tomb walls, coffins and papyri. It is assumed that these derive directly from Old Kingdom examples, mainly because of the accuracy of the copies and the preserved orthography. An interesting point is that they include spells that are not known from the Old Kingdom itself.
The Pyramid Texts are a colorful collection of hundreds of spells; none of the pyramids contains all of the spells and the places where they are inscribed also vary. Various types of text can be recognized. Firstly, there are the spells with a ritual character. These are probably related to the rituals accompanying the burial of the king. Among them we find the earliest version of the Opening of the Mouth ritual. There are also extensive offering rituals. A large part of the corpus is directed towards the continued life of the deceased in the hereafter, the so-called 'Sakhu' or 'Transfigurations', texts that turn the deceased into an 'Akh' or ‘Spirit'. The way some of these are phrased indicates that they were intended to be spoken aloud by the deceased himself. Then there are the texts whose aim it is to protect the deceased through magic. A large part of the body of ideas appears to have originated in Heliopolis. The sun god Re and the continued life of the deceased in his kingdom are continually emphasized. In addition, the underworld of Osiris is also mentioned, but always in an unfavourable sense: the deceased does not want to be trapped down in Osiris's dark abode.