Louvre curator and Priory of Sion Grand Master Jacques Saunière is fatally shot one night at the museum by an albino Catholic monk named Silas, who is working on behalf of someone he knows only as the Teacher, who wishes to discover the location of the "keystone", an item crucial to the search for the Holy Grail. After Saunière's body is discovered in the pose of the Vitruvian Man, the police summon Harvard Professor Robert Langdon, who is in town on business. Police Captain Bezu Fache tells him that he was summoned to help the police decode the cryptic message Saunière left during the final minutes of his life. The message includes a Fibonacci sequence out of order. Langdon explains to Fache that Saunière was a leading authority on the subject of goddess artwork and that the pentacle Saunière drew in his own blood represents an allusion to the goddess and not "devil worship", as Fache says.
A police cryptographer, Sophie Neveu, secretly explains to Langdon that she is Saunière's estranged granddaughter, and that Fache thinks Langdon is the murderer, because her grandfather's message said "PS Find Robert Langdon", which she says Fache had erased prior to Langdon's arrival. Neveu is troubled by memories of her grandfather's involvement in a secret pagan group. However, she understands that her grandfather intended Langdon to decipher the code, which she and Langdon find leads them to a safe deposit box at the Paris branch of the Depository Bank of Zurich. Neveu and Langdon escape from the police and visit the bank. In the safe deposit box they find the keystone: a cryptex, a cylindrical, hand-held vault with five concentric, rotating dials labeled with letters. When these are lined up correctly, they unlock the device. If the cryptex is forced open, an enclosed vial of vinegar ruptures and dissolves the message inside the cryptex, which was written on papyrus. The box containing the cryptex contains clues to its password.
Langdon and Neveu take the keystone to the house of Langdon's friend, Sir Leigh Teabing, an expert on the Holy Grail. There, Teabing explains that the Grail is not a cup, but a tomb containing the bones of Mary Magdalene. The trio then flees the country on Teabing's private plane, on which they conclude that the proper combination of letters spell out Neveu's given name, "SOFIA." Opening the cryptex, they discover a smaller cryptex inside it, along with another riddle that ultimately leads the group to the tomb of Isaac Newton in Westminster Abbey.
During the flight to Britain, Neveu reveals the source of her estrangement from her grandfather, ten years earlier. Arriving home unexpectedly from university, Neveu clandestinely witnesses a spring fertility rite conducted in the secret basement of her grandfather's country estate. From her hiding place, she is shocked to see her grandfather having sex with a woman at the center of a ritual attended by men and women who are wearing masks and chanting praise to the goddess. She flees the house and breaks off all contact with Saunière. Langdon explains that what she witnessed was an ancient ceremony known as Hieros gamos or "sacred marriage".
By the time they arrive at Westminster Abbey, Teabing is revealed to be the Teacher for whom Silas is working. Teabing wishes to use the Holy Grail, which he believes is a series of documents establishing that Jesus Christ married Mary Magdalene and bore children, in order to ruin the Vatican. He compels Langdon at gunpoint to solve the second cryptex's password, which Langdon realizes is "APPLE." Langdon secretly opens the cryptex and removes its contents before destroying it in front of Teabing. Teabing is arrested by Fache, who by now knows that Langdon was innocent. Bishop Aringarosa, realizing that Silas has been used to murder innocent people, rushes to help the police find him. When the police find Silas hiding in an Opus Dei Center, he assumes that they are there to kill him, and he rushes out, accidentally shooting Bishop Aringarosa. Bishop Aringarosa survives but is informed that Silas was found dead later from a bullet wound.
The final message inside the second keystone leads Neveu and Langdon to Rosslyn Chapel, whose docent turns out to be Neveu's long-lost brother, whom Neveu had been told died as a child in the car accident that killed her parents. The guardian of Rosslyn Chapel, Marie Chauvel Saint Clair, is Neveu's long-lost grandmother. It is revealed that Neveu is a descendant of Jesus Christ and Mary Magdalene. The Priory of Sion hid her identity to protect her from possible threats to her life.
The real meaning of the last message is that the Grail is buried beneath the small pyramid directly below the inverted glass pyramid of the Louvre. It also lies beneath the "Rose Line," an allusion to "Roslyn." Langdon figures out this final piece to the puzzle in the last pages of the book, but he does not appear inclined to tell anyone about this.