Three years after the events of the third film, Manny and Ellie are living happily with their teenage daughter Peaches. However, while Ellie supports and accepts her daughter’s desire to explore and meet new people, Manny instead becomes exceedingly overprotective, irritating Peaches and driving a wedge between the two. Meanwhile, Sid's family returns, but only to drop off the elderly Granny before promptly abandoning them both. Manny then catches Peaches hanging out with a group of teenage mammoths he does not approve of, causing a fight between him and Peaches. Shortly after, a sudden continental break-up (caused by Scrat trying to bury his acorn again) separates Manny from The Herd. Trapped on moving chunks of ice, Sid, Granny, Diego, Manny and Scrat (but without his acorn) have no choice but to ride out the current. At the same time, a giant land shift encroaches on Ellie, Peaches, and those remaining on land, forcing them to make their way towards a land bridge in order to get to safety. Meanwhile, Scrat finds another acorn at the bottom of the ocean, but a broken one that, inside, shows a map to "The Lost City Of Scratlantis" which Scrat sets off for.
After encountering a violent hurricane which pushes them further away from land, Manny's group is captured by a band of pirates sailing on a floating iceberg led by a Gigantopithecus, Captain Gutt, who attempts to pressure them into joining his crew. When Manny refuses, Gutt tries to execute them; this leads to their escape, which inadvertently causes the ship and food supplies to sink. Gutt's first mate, a female sabretooth named Shira, is forced to join them after she is rescued after being left for dead by her mates.
The Herd washes ashore on Switchback Cove, which gives a current back to their home. After learning that Gutt has enslaved a group of hyrax and is using them to build a new iceberg ship, Manny coordinates a plan with some more hyrax to free their comrades and steal the ship, and they are able to create a diversion. Just before they manage to escape aboard the ship, Diego tries to convince Shira to leave the pirates and join The Herd for a better life, but Shira, while initially accepting, instead stays behind and slows Gutt down so The Herd can escape. Gutt forms yet another ship and plots revenge on Manny.
Meanwhile, during the animals' trek to the land bridge back on the mainland, Peaches joins the group of mammoths from before, only to find out that they do not care about the ongoing danger and they look down on her for being friends with a mole hog named Louis. When Louis overhears Peaches telling the other mammoths that they are not actually friends, Peaches realises who her true friends are, berates the others for their cocky attitudes and storms off.
After narrowly escaping a pack of sirens, Manny, Sid, Diego, and Granny return home and find that not only has the land bridge been destroyed, but Gutt has beaten them and taken Ellie, Peaches, and the rest of The Herd hostage. A fight ensues, as Granny's pet whale, Precious, arrives and fends off Gutt's crew. Manny defeats Gutt in a final duel on an ice floe and reunites with his family and friends. Gutt subsequently encounters a siren that assumes the shape of a female Gigantopithecus, who eats him alive by trapping him in a giant clam. In the aftermath, Peaches happily reconciles with both Manny and Louis, and Shira joins The Herd and starts a romantic relationship with Diego. With their home destroyed by the land shift, Precious takes the entire Herd to a lush island, where the hyraxes from earlier have already started rebuilding their civilization.
In the epilogue, Scrat finally reaches Scratlantis, where Ariscratle welcomes him. When Scrat sees the acorns everywhere, he is overpowered by them and is eagerly hyperactive. When Ariscratle warns him not to take anymore, Scrat unsuccessfully attempts resistance, but then pulls an acorn plug where water comes in and flushes the entire city down. Scrat survives, but when trying to dig where the city is now, the ground cracks as he is in a dry desert known as the Death Valley.