Kheperkheprure Ay (occasionally Ai) was the penultimate Pharaoh of Ancient Egypt's 18th dynasty. He held the throne of Egypt for a brief four-year period (probably 1325-1321 BC or 1327-1323 BC, depending which chronology is followed), although he was a close advisor to two (perhaps three) of the pharaohs who ruled before him and was the power behind the throne upon which his immediate predecessor sat.

Born a commoner, Ay managed to rise through the hierarchy of Egyptian society under the "heretical" Pharaoh Akhenaten. One version of events maintains that he and his wife Tey were the parents of Akhenaten's chief wife, Nefertiti (and, incidentally, that another of their daughters, Mutnodjme, was the wife and queen of Ay's successor Horemheb). Another version suggests that he was the brother or half-brother of Tiy, Amenhotep III's queen, and thus Pharaoh Akhenaten's uncle. The two theories are not mutually exclusive, but either relationship would explain the exalted status to which Ay rose (he was styled "Fanbearer at the King's Right Hand") during Akhenaten's Amarna interlude, when the royal family turned their backs on Egypt's traditional gods and experimented, for a dozen years or so, with monotheism – an experiment that, whether out of conviction or convenience, Ay seems to have supported, at least for as long as it lasted.

Akhenaten's reign was followed by that of the boy-king Tutankhamen, who ascended to the throne at the age of nine or ten, at a time of great tension between the new monotheism and the old pantheism. He was assisted in his kingly duties by his predecessor's two closest advisors: Grand Vizier Ay and General of the Armies Horemheb. Tutankhamen's nine-year reign, largely under Ay's direction, saw the gradual return of the old gods – and, with that, the restoration of the power of the established pantheistic priesthood, who were furious at having had their influence sidestepped under Akhenaten.

Tutankhamen's untimely death at the age of 18, together with his failure to produce an heir, left a power vaccum that his Grand Vizier was quick to fill: Ay is depicted in the famous treasures of the boy king's tomb conducting the funerary rights for the deceased monarch and assuming the role of heir. The grounds on which Ay based his claim to the throne are not entirely clear. He was certainly a powerful figure under Tutankhamen, as he had been under Akhenaten: in some records he is referred to as "regent", and he had been close to the center of power for some 25 years. This was probably not enough, however, within the highly hierarchical society of Ancient Egypt, particularly at a time of upheaval and counter-reformation. To strengthen his claim, Ay appears to have married Tutankhamen's widow Ankhesenpaaten (by then known as Ankhesenamun). By then advanced in years, Ay ruled Egypt in his own right for four years, consolidating the return to the old religion that he had initiated as Tutankhamen's advisor. He was succeeded, at the end of the dynasty, by Horemheb.

One of Horemheb's undertakings as pharaoh was to attempt to eliminate all references to the monotheistic experiment, a process that included expunging the name of his immediate predecessors – Ay included – from the historical record.

Ay had tombs prepared for himself in both Amarna and Thebes. The former, still visible today, is well preserved and provides some excellent examples of the distinctive style of art that flourished during the Amarna period. It was never finished, however, or used for his burial. Ay was ultimately buried in his second tomb (designated KV23) in the western branch of the Valley of the Kings.