A Viking boy called Hiccup (voice: Jay Baruchel) introduces his village of Berk ("it's been here for seven generations, but every single building is new"). The village is attacked by dragons, who steal food (mostly sheep) and set things on fire (hence all the new buildings). The villagers grab weapons and try to fight the dragons off. Despite being told by every adult in sight to go indoors, Hiccup hauls out a bolas-shooting cannon he made himself and shoots a dragon out of the night sky. (As assistant to the village blacksmith, Gobber (voice: Craig Ferguson), Hiccup has access to tools and materials and knows how to use them.) The dragon lands in the woods some distance form the village and no one believes that he hit anything, so it's the next day before Hiccup can go looking for it. It turns out to be a rare and deadly Night Fury, but Hiccup can't make himself kill it. Instead he releases it -- whereupon it also refrains from killing Hiccup -- and it flies off through the trees.
Hiccup discovers that the dragon (which he eventually calls Toothless because of its retractable teeth) has holed up in a steep-sided valley because it can no longer fly more than a few feet at a time. While sketching the dragon, Hiccup realizes that it's missing a tail fin. He makes a prosthetic tail fin out of leather. The new fin helps, but Toothless can't control it and inadvertently takes Hiccup for a ride, giving him a clear idea of what's needed to help the dragon fly right. In a series of workshop and test flight scenes, Hiccup builds and perfects a saddle, a control mechanism for the tail fin, and a safety harness.
Meanwhile, Hiccup's father Stoick (voice: Gerard Butler) has signed him up for dragon training with Gobber, which is very different from the training he's already doing with Toothless: he's going to learn to fight dragons. At first, he's the worst student in the class. Since Hiccup has always been an accident-prone klutz, this comes as no surprise to his classmates Astrid (voice: America Ferrera), Snotlout (voice: Jonah Hill), Fishlegs (voice: Christopher Mintz-Plasse), Ruffnut (voice: Kristen Wiig), and her twin brother Tuffnut (voice: T.J. Miller). (Hiccup's a little sweet on Astrid.) Before long, Hiccup is able to use some things he's learned while working with Toothless to soothe and manage the school's practice dragons. (It turns out dragons are just big kitty-cats: they like to be petted, there's a kind of grass that's like cat-nip to them, and they love fish (but hate eels).) When Stoick returns from a failed search for the fabled nest of the dragons, he's surprised but thrilled to hear that his son is doing brilliantly at dragon training. He gives Hiccup a horned helmet made from one of his dead mother's breastplates. But Hiccup, as usual, is unable to get around his father's expectations and speak frankly, so he can't explain that his success at dragon school is unlikely to lead to the slaying of any dragons.
When Hiccup subdues a practice dragon, unintentionally earning the privilege of killing it before the entire village, he's horrified and decides to flee with Toothless. However Astrid, having noticed Hiccup's frequent disappearances and secretive behavior, is suspicious. She follows him to the hidden valley and sees Toothless. Unable to explain his relationship with the dragon, Hiccup takes her flying, and she's captivated. But they get caught up in a flock of dragons returning to their nest carrying food. The dragons fly inside a mountainous island and drop the food into a pit, which turns out to contain a huge, terrifying, and very hungry dragon that eats the smaller ones if they don't bring it enough food. Hiccup and Astrid and shocked to realize that the dragons have been stealing their sheep to keep from being eaten themselves. When they get home, Hiccup convinces Astrid not to reveal the location of the dragon nest. Before she goes, she punches him in the arm and says "That's for kidnapping me." Then she kisses him and says "That's for everything else."
Everything goes wrong at the dragon-killing ceremony. Hiccup discards his weapons in an attempt to show the Vikings that dragons only fight to defend themselves, but Stoick and others intervene and the dragon attacks. Toothless comes to the rescue and is on the verge of killing Stoick when Hiccup calls Toothless off. Despite Hiccup's protests, the angry Vikings chain Toothless up. When he ineptly tries to explain, Hiccup lets it slip that Toothless took him to the nest of the dragons, and Stoick resolves to use Toothless to find the nest again. He won't listen to Hiccup's warnings about the giant dragon. He loads Toothless on his ship and the Viking fleet sails off with all the warriors in the village, disowning Hiccup and leaving him behind. When Hiccup wonders aloud why he didn't kill Toothless when he had the chance since it would have avoided all of this, Astrid challenges him to explain why. In doing so, Hiccup comes to an epiphany about his moral character, his personal strength and Astrid's faith in him. Inspired, Hiccup and his classmates mount the practice dragons and fly off in pursuit of the fleet.
At the dragons' island, the Vikings use catapults to break open the side of the mountain in which the giant dragon is trapped. When it comes out, Stoick realizes that he's made a mistake. He resolves to fight it himself to buy the other Vikings time to escape; Gobber volunteers to join him. While Stoick and Gobber prepare to sacrifice themselves to distract the dragon, the kids arrive to join the battle. They do manage to distract the giant dragon a little, but it sets the Vikings' ships on fire. While his comrades keep the giant dragon occupied, Hiccup tries to rescue Toothless (who's still in chains) from the burning ship, but they end up under water and Stoick rescues both of them. Then Toothless and Hiccup go after the giant dragon together. They draw it up into the clouds and away from the Vikings, trying to get it to crash on the island. In the end Toothless releases a blast into the giant dragon's open mouth and it crashes and burns, apparently taking our heroes down with it -- we see Hiccup fall toward the fire as Toothless tries desperately to catch him. On the ground, a heartbroken Stoick approaches the wounded Toothless wondering what has become of his son; Toothless opens his wings to show that he saved Hiccup. ("Well, most of him," Gobber remarks cryptically.)
Back at home, Hiccup wakes up and Toothless urges him out of bed. Hiccup finds that he lost his left foot in the battle with the giant dragon. However, Gobber has made him a new one, ingeniously spring-loaded. (Hiccup and Toothless now have matching disabilities.) They go out into the village, which is full of swooping, frolicking dragons; the Vikings now treat them as pets. Astrid greets Hiccup with a kiss. Supplied by Gobber with a new tail fin prosthetic and saddle for Toothless, Hiccup takes flight with Astrid and his friends as he exults at the new alliance of Vikings and Dragons.