Dobby is a house-elf, a creature bound to serve one wizard family or household for life. He is short with a long, thin nose, bat-like ears and large, bulging green eyes. He wears an old pillowcase in place of clothing.
Dobby appears at number four, Privet Drive on Harry’s birthday. He attempts to make Harry promise not to return to school, claiming that there is a plot to make terrible things happen at Hogwarts and that for Harry’s safety it is best if he remains with the Dursleys. Dobby punishes himself whenever he comes close to speaking ill of his masters or when he disobeys orders. Because of this, he is unable to name the culprit behind the supposed plans, and causes himself bodily harm instead.
Dobby is responsible for Harry's lack of letters over the summer; he has been intercepting them in an attempt to discourage Harry from returning to school. When he is unable to extract a promise from Harry that he will not return to school, Dobby uses a Hover Charm to make Petunia’s violet pudding crash to the floor, for which the Dursleys lock Harry up in his bedroom as punishment.
Dobby charms a Bludger to attack Harry during the Gryffindor versus Slytherin Quidditch match. He hopes to injure Harry grievously enough to send him away from the school. He continues to beg Harry to leave Hogwarts, and accidentally reveals that the Chamber of Secrets has been opened before.
Dobby accompanies Lucius Malfoy to Hogwarts at the end of the school year, and prompts Harry to realise that Lucius planted Tom Riddle’s diary with Ginny. Dobby gains his freedom when Harry tricks Lucius into giving the house-elf a sock. When Lucius attempts to retaliate by attacking Harry, Dobby comes to Harry's aid.
Harry mistakes the house-elf Winky for Dobby at the Quidditch World Cup match. Winky tells Harry that Dobby talks about Harry all the time. She says that freedom has gone to Dobby's head, and that he has ideas above his station; he is asking to be paid to work, and hasn't been able to get a job because of this.
Dobby greets Harry enthusiastically in the kitchens. He hurtles across the room squealing Harry's name and hits the boy hard in the midriff, hugging him tightly. Dobby is thrilled that Harry has come to see him at last. Dobby is wearing a very strange assortment of garments; a tea-cosy for a hat, on which he has pinned a number of bright badges; a tie patterned with horseshoes over his bare chest; a pair of what looks like children's football shorts, and odd socks. One of the socks is the black one Harry used to trick Lucius Malfoy into freeing Dobby.
Dobby tells Harry, Ron and Hermione that he and Winky got their jobs at Hogwarts at the same time. He offers the trio cups of tea, and hands them around when they arrive. Dobby tells Harry that he searched for a job for two years trying to find work, but that it was very difficult, as he had been dismissed from his previous job. He has been at Hogwarts for one week and loves his new job; he is still a free elf, and is being paid one Galleon a week, and gets one day off a month. He tells Hermione that Dumbledore offered him ten Galleons a week, and weekends off, and shivers as though the idea of so much leisure and riches frightens him. Dobby says that he likes freedom but that he doesn't want too much, as he likes work better.
Dobby tells Harry that house-elves are not allowed to speak ill of their masters but that Dumbledore has said that Dobby can call him a barmy, old codger if he likes. Dobby looks doubtful when Harry asks whether he can speak ill of the Malfoys now that he is free, but then squares his shoulders and tells Harry that his old masters were bad Dark wizards. He stands for a moment after saying this, quivering all over, horrified by his own daring, then rushes over the nearest table and begins to bang his head on it to punish himself. He isn't yet used to being able to talk about the Malfoy family freely, but defiantly says that he doesn't care what they think anymore. Dobby tells Harry that he is going to buy a jumper next with his wages, and is delighted when Ron offers to give him this year's Christmas jumper from his mother. As Harry, Ron and Hermione prepare to leave the kitchens, Dobby tentatively asks whether he can visit Harry and beams when Harry agrees.
Dobby visits Harry in the dormitory on Christmas morning. He stands on Harry's bed, so close they are almost nose to nose, until Harry awakes. Dobby jumps back when Harry yells at him, and stands anxiously next to Harry's bed, waiting for Harry to get up. He is thrilled to receive a pair of socks from Harry, but is confused as to why the shop gave Harry two of the same design. He happily accepts a pair of violet socks from Ron so that he can mix them up, as well as the hand-knitted jumper that Mrs Weasley made for Ron. Dobby gives Harry a pair of socks for Christmas, one bright red with a broomstick pattern, the other green with a pattern of Snitches. He made the socks himself, buying the wool with his wages. Dobby leaves after exchanging gifts, on his way to prepare Christmas dinner in the kitchens.
Dobby wakes Harry ten minutes before the second task is due to begin and is determined that Harry will complete the task. Dobby says that he knew Harry hadn't found the right book to help with the task, and so he found a method of breathing underwater for Harry. Dobby hands Harry a ball of Gillyweed, and tells him to eat it right before he enters the lake, as it will allow him to breathe underwater. Dobby overheard Professor Moody and Professor McGonagall talking about the task in the staff room as he was working, and didn't want Harry to risk losing Ron.
Dobby is thrilled when Harry, Ron and Hermione visit the kitchens, and is delighted with his new socks from Harry. His ears droop slightly when Hermione asks where Winky is, and he points her out by the fire. He is worried when, whilst attempting to persuade the house-elves that they don't have to be ruled by a master, Hermione uses him as an example. He asks her to keep him out of her argument, and looks scared, as the other house-elves find her views dangerous.
Dobby enters the Room of Requirement during one of the DA lessons and finds Harry, tugging at his robes to get attention. His eyes are wide with terror, and he is shaking. He begins to warn Harry about something but pauses to punish himself as the house-elves have been told not to mention anything; he runs head-first into the wall of the Room of Requirement, but merely bounces off the stone, protected by the eight wooly hats he is wearing. Dobby struggles to tell Harry that Professor Umbridge has found out about the DA, and that she is on her way to the Room of Requirement, forcing Harry to guess most of the details. Dobby is picked up by Harry as the students run towards the exit, only set down once they reach the back of the queue to leave; he is ordered to go back to the kitchens, and to lie if he is asked whether he warned Harry.
Dobby appears at Malfoy Manor to save Harry, Ron and Hermione. He causes the chandelier in the drawing room to crash to the floor to protect Harry, and tells his old mistress that he must not hurt Harry. His hand is seized by Harry and the pair Apparate from the Manor together.
Dobby dies just after he and Harry arrive at Shell Cottage, wounded by Bellatrix Lestrange's silver knife. He is buried in the garden of the cottage. His headstone is inscribed by Harry to read Here lies Dobby, a Free Elf.