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 in 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 on his chest in his own blood represents an allusion to the goddess and not devil worship, as Fache believes.
Sophie Neveu, a police cryptographer, secretly explains to Langdon that she is Saunière's estranged granddaughter, and that Fache thinks Langdon is the murderer because the last line in her grandfather's message, which was meant for Neveu, said "P.S. Find Robert Langdon," which 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 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 a box containing 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 breaks 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 home of Langdon's friend, Sir Leigh Teabing, an expert on the Holy Grail, the legend of which is heavily connected to the Priory. 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 secretly 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 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 tossing the empty cryptex in the air.
Teabing is arrested by Fache, who by now realizes that Langdon is innocent. Bishop Aringarosa, head of religious sect Opus Dei and Silas' mentor, 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 gunshot 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 and her brother are descendants 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 La Pyramide Inversée, the inverted glass pyramid of the Louvre. It also lies beneath the "Rose Line," an allusion to "Rosslyn." Langdon figures out this final piece to the puzzle; he follows the Rose Line to La Pyramide Inversée, where he kneels before the hidden sarcophagus of Mary Magdalene, as the Templar knights did before him.