The Trace

The Trace is a Charm put on wizards and witches who are under seventeen years of age. When any magical activity is performed in the vicinity of the underage individual, the Improper Use of Magic Office within the Ministry of Magic is alerted to the spell that was used and to the location of the caster and the time. The charm allows the Ministry to track underage magic, which is banned under the Decree for the Reasonable Restriction of Underage Sorcery. The Trace automatically breaks upon a wizard or witch's seventeenth birthday; Remus Lupin and Ron Weasley each claimed that it was impossible for the Trace to continue to function on a person over the age of seventeen, and that it could not be placed on an adult.

Implementation and use
It is unknown how a witch or wizard is imbued with the Trace, but it appears to be universal with magical children. It does not need to be removed but breaks automatically upon reaching adulthood.

The Ministry trusts magical parents to properly discipline their children if they perform magic due to the fact that the parents' own magic will constantly interfere with the Trace. Children who grow up in the Muggle world, such as Harry Potter, are more closely monitored — any magic that was performed at or near 4 Privet Drive was assumed to have been caused by him because he was the only known magical person living in his neighbourhood. Thus, when the house-elf Dobby used magic at that location, the Ministry blamed Harry.

Limitations
Either the Trace is lifted or the Ministry does not monitor it when underage witches and wizards are attending Hogwarts School of Witchcraft and Wizardry, holidays not included, allowing students to perform magic freely. It appears that students can also use magic freely on the Hogwarts Express.

The Trace's effectiveness appears to be somewhat inconsistent. Alastor Moody mentioned that any magic around an underage witch or wizard will activate the Trace, and, as above-mentioned, the Ministry can erroneously attribute that magic to the underage individual. However, Arthur Weasley used magic around Harry that was not blamed on him. It is probable, however, that, because Arthur arranged a Floo connection to the fireplace of Number 4, the Ministry knew that an older wizard was present at the time. It is also possible, though less likely, that the Ministry was alerted to this but recognised some aspect of the magic as belonging to an adult wizard.

Similarly, when the Order of the Phoenix escorted Harry from Number 4, several spells and charms were cast; however, no Ministry warnings were sent. Although it is probable, given Harry was already up on a charge of Misuse of Magic at the time, that the Order informed the Ministry they would be collecting Harry and that they might use magic around him.

Hermione Granger also admitted to successfully trying out "a few simple spells" just prior to her first year at Hogwarts School of Witchcraft and Wizardry, but, apparently, she never received any notification that this was banned even though, as a Muggle-born witch, it is unlikely that there were any other wizards or witches in her vicinity whom the Ministry could have believed cast the magic instead. However, this is probably because the Ministry does not monitor pre-Hogwarts students because their magic is normally uncontrollable. This may, however, indicate that the Trace is actually put in place after students begin formal learning.

Curiously, when Harry was transported to the graveyard and duelled Voldemort there was no indication the Ministry was aware of it. It is possible that the Trace on Hogwarts students is lifted or not checked during the school year, or that the graveyard may have had powerful enchantments cast on it to suppress scrying and location magics, or the Trace in particular.

Another inconsistency is that when Tom Riddle was sixteen, he murdered his father and grandparents with the Killing Curse and then modified his uncle Morfin Gaunt's memory so that he would confess to the crime. While Dumbledore explained how Riddle's magic in the Gaunt shack would go unnoticed, no explanation is given as to how three uses of the Killing Curse by a sixteen-year old in a Muggle home were overlooked. It is also possible that due to his uncle being in residence there, the Ministry may have felt the magic was not used by Riddle. Although it seems more likely, given Riddle's powerful nature, he devised a way to block or even dispel the Trace since the Ministry is not recorded as having been aware of his presence in the area or his later secret creation of at least one Horcrux while he was of school age. It should be noted, however, that with the Ministry's patchy history on this front, it is possible his presence in the area was never cross-referenced with the murders or was deemed irrelevant and that it is unknown precisely when or where Riddle created his early Horcruxes.

Also, the fact that the Ministry generally ignores when the Trace is broken by underage wizards and witches of wizarding families, expecting their parents to discipline them, essentially makes it useless at monitoring their use of magic. It could be argued, as a result of this, that children born into wizarding households have more legal "wiggle-room," when breaking the restriction for underage wizardry, than half-bloods living with all Muggle relations (like Harry) and Muggle-borns.

Examples of the Trace being activated

 * Harry Potter received a warning from the Improper Use of Magic Office in 1992 because the Ministry detected the use of a Hover Charm in his vicinity via the Trace and attributed it to him, though it was in fact used by Dobby.
 * Harry used a Patronus in 1995 to defend himself and his cousin from Dementors, activating the Trace because he was only fifteen years old at the time. He was at first expelled from Hogwarts but was reinstated because the Ministry had no right to expel students. Harry was later cleared in a full Wizengamot trial since Clause 7 of the Decree for the Reasonable Restriction of Underage Sorcery permits the use of magic in front of Muggles to defend oneself in a life-threatening situation.

Etymology
Trace, as the English word meaning a path, refers to how a person's magic is "traced" to his or her location.

Behind the scenes

 * In the film versions of Harry Potter and the Philosopher's Stone and Harry Potter and the Chamber of Secrets, Hermione casts the Oculus Reparo spell on Harry's glasses in the former while aboard the Hogwarts Express and in the latter in public in Diagon Alley (the second use does not occur in the novel, with an older character casting the spell). In neither case is it indicated that Hermione is warned or punished. It is possible the Trace (in the film continuity) does not apply to magic use on the train - which could be seen as an extension of the school - or in the "Muggle-free" environment of Diagon Alley. Alternately, it is possible the use of some mundane, harmless spells such as Oculus Reparo may be overlooked (as opposed to more major violations such as the Hover Charm or the Patronus charm). However, when used on the train, there were some adult wizards and many Hogwarts students (some of whom are seventh years and possibly already turned 17), and in the case of Diagon Alley, it was an all-wizard location, and almost everybody was of age.
 * At the beginning of the third film, we see Harry in his room at Privet Drive, utilising Lumos Maxima without any warnings from the Ministry. In the book, however, we find him writing an essay.
 * In the fourth Harry Potter book, the Weasleys broke out of the Dursleys' fireplace by using magic, and Mr. Weasley used magic to return Dudley's tongue to its original size. In the case of the fireplace they cannot be said to be inside the house, yet, and in the case of the tongue-spell Harry was not in the house at that point.
 * In the fifth novel, Tonks used some household spells in Harry's room while helping him to pack his things. This, however, did not seem to have had any legal consequences. However, Harry was already in so much trouble that they probably did not notice that.

Appearances

 * Harry Potter and the Chamber of Secrets
 * Harry Potter and the Chamber of Secrets (film)
 * Harry Potter and the Order of the Phoenix
 * Harry Potter and the Order of the Phoenix (film)
 * Harry Potter and the Deathly Hallows
 * Harry Potter and the Deathly Hallows: Part 1
 * LEGO Harry Potter: Years 5-7