The island of Berk is a Viking village that is plagued by attacks from dragons that steal its livestock. A teenager named Hiccup, the awkward son of village chieftain Stoick the Vast, is unable to wield the usual weapons to fight dragons. He has fashioned mechanical devices under his apprenticeship with Gobber the blacksmith to aid in defense. During one attack, Hiccup believes he has shot down a Night Fury, an extremely dangerous dragon and later finds it trapped in his bolas. Hiccup tries to kill it, but finds himself unable to and instead cuts it free; the Night Fury roars and disappears into the forest.

Stoick assembles a fleet to seek out the dragons' nest, placing Hiccup in a dragon fighting class taught by Gobber. The most proficient of his classmates is Astrid, a girl he secretly likes. Hiccup realizes that the Night Fury cannot fly properly due to an injured tail. After finding it trapped in a glade, Hiccup earns the dragon's trust and begins to care for it. He names the Night Fury "Toothless", for its retractable teeth. Later, Hiccup fashions a makeshift harness and prosthetic tail piece that allows him to guide the dragon in free flight. Hiccup is able to transfer his knowledge of Toothless's behavior to the other species of dragons and becomes the star pupil, much to Astrid's dismay. Hiccup is given a dilemma when he is tasked with killing a dragon in front of the village to complete the class. Stoick's unsuccessful fleet arrives home, but his spirits are lifted upon hearing of Hiccup's success.

Astrid discovers Hiccup training with Toothless, but before she can tell the village, Hiccup takes her for a ride. Toothless unexpectedly joins a flock of dragons and takes the pair to the dragon's nest, where they discover a gigantic dragon named the Red Death.[note 1] The Red Death depends on the food the other dragons bring back; if there is not enough, it feeds on the smaller dragons themselves. After swiftly escaping the island, Astrid wants to tell the village of the nest, but Hiccup asks her to keep it a secret to protect Toothless.

Hiccup tries to exhibit the dragon's true nature during his exam but Stoick stops the fight and inadvertently angers the dragon. Toothless arrives in the ensuing panic only to be captured as well. Whilst being scolded by his father, Hiccup accidentally reveals how to find the dragons' nest. Stoick disowns his son and sets off for the nest using Toothless as a guide. The Vikings find themselves outmatched against Red Death while Hiccup makes a plan to save them. When Hiccup and his classmates arrive flying dragons, Stoick is amazed at their abilities. Hiccup almost drowns trying to break Toothless free of a sinking ship. Stoick saves both of them and admits that he was wrong. Hiccup and Toothless engage the Red Death and kill it in a massive explosion. Toothless shields Hiccup as they are apparently consumed by the flames.

Hiccup wakes up back on Berk, discovering his left foot has been amputated and replaced with a prosthesis made by Gobber. He is elated as he steps outside to find the Vikings and dragons working together to rebuild their village, and Astrid rushing to kiss him. The film ends with the war between Vikings and dragons finally over.