In the opening scene, young Henry Turner (Lewis McGowan) leaves his home in the dark of night to take a rowboat out to the middle of the ocean. He finds himself pulled down to the bottom of the sea and inside the cursed ghost ship, the Flying Dutchman.
Henry finds his father, Will (Orlando Bloom), still cursed as captain of the Dutchman. Henry wants to break his father's curse using the fabled Trident of Poseidon and he thinks he can get it with the help of Captain Jack Sparrow (Johnny Depp), but Will thinks it's a lost cause and urges his son to stop his quest. He sends Henry back up to his boat.
Nine years later, Henry (now played by Brenton Thwaites) is a member aboard a British Royal Navy ship, the Monarch. He realizes that the ship is headed toward the Devil's Triangle, a dangerous place in the Atlantic Ocean where ships are not meant to sail. Henry rushes to warn the captain of their course, but is charged with insubordination and is locked up in the ship's brig.
Sure enough, the warship passes through the rocky walls that lead into the Devil's Triangle. They are soon attacked by the undead pirates of the Silent Mary. The ghost pirates slay the soldiers one by one. Boarding the warship is Captain Armando Salazar (Javier Bardem). He makes his way down to the brig and sees a wanted poster for Jack Sparrow. Salazar finds Henry's cell and orders the boy to send a message to Jack that Salazar will be coming for him.
On the island of St. Martin, a young woman named Carina Smyth (Kaya Scodelario) is locked up in a cell after being accused of witchcraft. In reality, she is just very knowledgeable in astronomy and horology. While speaking to a guard, she manages to pick her lock and escape.
Meanwhile on the island, Jack has broken into a bank vault and is found sleeping in it. His crew hooks up the whole bank to a bunch of horses and has them pull it through the streets. They make it back to Jack's new ship, the Dying Gull, which is strapped to a small shack by the shore.
When the crew brings the vault onto the ship, they find the whole thing empty, save for a single coin (which Jack nabs for himself, naturally). The crew has become frustrated with how Jack has been leading them. Even Mr. Gibbs (Kevin McNally) has lost faith in old Jack. They all turn their backs on him and leave him alone.
Henry is still a prisoner of the British Royal Navy, and is now set to be executed for treason, but he is surprised to find Carina having disguised herself to find Henry personally. She wants to help Henry find the Trident of Poseidon and can do so with the help of a diary she has in her possession that has a map to the Trident, and the map only came into view during a blood moon with the help of a red jewel that she has been carrying.
Jack goes to trade his magic compass (the one that points the holder to what they most desire) for a bottle of rum. Once the transaction is made, it causes Salazar and his crew to be released from the Devil's Triangle, allowing them to roam the seas and seek out Jack.
Carina helps Henry escape, but she and Jack end up captured. While in his cell, Jack meets Henry and learns he is the son of the late Will Turner and Elizabeth Swann. Henry turns out to be disappointed when he finds Jack, seeing him as a disgraced drunk locked up in a cell. He tells Jack how he plans to break his father's curse. Jack and Carina are brought to the gallows for their execution.
On the way to the noose, Jack stops by a cell and finds his Uncle Jack (Paul McCartney), who has seen better days but is still content in his pirate life. Before Jack and Carina's sentences are carried out, Henry rounds up Jack's crew to help them free, even though it's only because Henry is paying them to save Jack. The pirates fight the guards and the executioner, with Carina nearly getting hung until Henry catches her. Everyone makes their way to the Dying Gull, and they manage to release it from its holdings.
Somewhere else across the ocean, Captain Hector Barbossa (Geoffrey Rush) is enjoying his time as the captain of the Queen Anne's Revenge after taking it from Captain Blackbeard, with his new crew helping him reap in much rewards. However, Barbossa learns that Salazar is out there. He meets with a sea witch, Shansa (Golshifteh Farahani), who has come into possession of the compass, which she hands to Barbossa.
Soon, Salazar and his crew find the Queen Anne's Revenge, and Salazar meets with Barbossa after learning he has the compass. He wants him to help catch Jack. Salazar explains his fight with Jack - many years earlier, Salazar was a powerful captain of the Spanish navy who went about the seas with his men slaying every pirate they came across. They came across a young Jack, still just a crew member aboard his ship.
As Salazar and his crew laid waste to Jack's crew, the young lad would quickly come into possession of the compass from one of his dying comrades. With his quick thinking, Jack tricked Salazar into sailing his ship into the Devil's Triangle. Salazar's ship and his men were destroyed, but the power of the Devil's Triangle brought them back to life as ghosts. Jack then became captain of his ship. Now Salazar wants to find the Trident to kill Jack and every last pirate out there. Barbossa agrees to help find Jack.
Aboard the Gull, Jack observes the growing attraction between Henry and Carina. He puts it to the test when he threatens to throw Henry overboard. The pirates do so, but they dropped him onto a rowboat and only reveal it to Carina after she has a frightened reaction.
Shortly after, the British Royal Navy show up and head toward the Gull, but they are mowed down by the Silent Mary. Salazar has his sights set on Jack, leading Jack to tell Gibbs and the rest of the crew that they are dealing with the dead. The ghost pirates attack Jack and his crew. Jack, Carina, and Henry board a rowboat while the others stay and fight. Carina hops off the rowboat and swims to the nearby island.
Before Henry can go ahead and do the same, Salazar has reanimated dead sharks and sends them after Jack and his crew. Jack and Henry try to evade the sharks, and they manage to hook onto one and use it to ride their boat to the shore. Salazar and his men run after them, but they are unable to touch land without burning up in the sun. Salazar vows to wait for Jack as he and Henry head into the island.
During their walk on the island, Jack is found by an old pirate comrade who claims is owed a favor from Jack. He forces Jack to wed his (repulsive) widowed sister and adopt their two children. Before the union can be made official, Barbossa shows up and unintentionally saves Jack. However, he still needs something from Jack - he wants to get the Black Pearl out of the bottle Jack has been carrying all along so that it can once again be free to sail the seas. Jack breaks the Pearl out of its bottle and has Barbossa push it into the water as it grows back to its enormous size.
On the way to the Trident, Barbossa has Jack tied to the mast. He goes to talk to Carina as she looks up at the stars. Barbossa suggests that Carina's father was a thief, and she slaps him in response. She tells Barbossa how she was named after a star. After seeing the design in her diary, Barbossa figures her name is Carina.
He goes back to Jack, and they both realize that Carina is Barbossa's daughter. He explains to Jack that he gave up a child for adoption a long time ago and figures this must be her. Barbossa doesn't want anyone else to know and he threatens to cut out Jack's tongue if he breathes a word.
Eventually, the Pearl reaches the island containing the Trident. Carina sees the points on the island matching the design of the stars' alignment. With the red jewel, she manages to uncover the Trident's location. The sea splits in two and reveals the Trident to be located at the bottom of the sea. Just as the crew approaches the Trident, Salazar and his crew find them as well. The pirates all engage in battle, with Salazar going after Jack. Salazar grabs the Trident and tries to kill Jack with it.
Henry and Carina realize that destroying the Trident breaks every curse on the sea. With the Trident pinned against Jack, Henry runs up and breaks the Trident. Salazar and his men return to their normal state. Gibbs and the others drop the anchor for Jack, Henry, Carina, and Barbossa to get back up. They grab on, but Salazar, not willing to rest until Jack is dead, follows after them with some of his men. As they reach the top, the sea starts coming together. Barbossa descends the anchor and faces Carina.
He reveals a tattoo on his arm of the stars, and Carina soon realizes what it means. She asks him what she is to him. Barbossa responds, "Treasure." He drops with his sword and hits Salazar, sending the captain and his men to their (now permanent) deaths, at the cost of Barbossa's own life. Once the other three make it back to the ship, the crew mourns Barbossa.
Henry and Carina are standing on a hill. They give in to their attraction and they kiss. She has also decided to take on the Barbossa name. Henry looks through a telescope and sees the Flying Dutchman surface. Will walks to the shore, now a free man at last. He approaches Henry and sees his necklace, knowing it belongs to his son. Will embraces Henry, who promises to tell him the story of how he freed him. They are soon joined by Elizabeth (Keira Knightley), who runs up to Will and kisses him.
Jack is once again captain of the Black Pearl, and the crew is ready to follow him once again. They set sail on their next adventure.
After the credits, Will is sleeping in bed with Elizabeth. The door opens and a shadowy figure slowly walks in. We then see the claw of Davy Jones! Will wakes up startled. He holds Elizabeth close, thinking it was a nightmare. He is unaware that there is a trace of Jones (wet barnacles) on the floor beneath them.