My library has a comprehensive rating system of books, and the Harry Potter series earned the following ratings:
Philosopher's Stone: U-MG (Upper Middle Grade)
Chamber of Secrets: U-MG (Upper Middle Grade
Prisoner of Azkaban: N-YA (New Young Adult)
Goblet of Fire: YA (Young Adult)
Order of the Phoenix: YA (Young Adult)
Half-Blood Prince: YA (Young Adult)
Deathly Hallows: E-YA (Edgy Young Adult)
I find this to be fairly accurate.
The most common argument seems to be that Harry Potter, while dark, isn't dark enough to even be considered "teen" or "YA" (even though it's a story about teenagers, had movies adapted from it that are largely PG-13, and has a 15+ average reading level,) because it's themes aren't any different from any Children's books, and to the people posing this argument, I must ask: did you read Harry Potter? Yes, Children's books can deal with dark topics. But let me ask you, are you seriously saying there's no difference between the peaceful, quiet death of Charlotte (a spider) in Charlotte's Web, and the bloody, horrific, and tragic death of Severus Snape, (a human,) in the Deathly Hallows? These books are patronized to a bizarre extent. I've never seen these books as children's books. Children's books present human drama and thematic material, if dark, in a soft, usually unnoticeable manner. The characters in Harry Potter are either teenagers or adults, if not, older children, and face themes and situations that are decidedly adult (political corruption, murder, torture, suicide, murder-suicides, the realities of war, obsession/love, trauma and PTSD, lust and sensuality, even, to a noticeable degree, rape and incest). These are characters who raise their voices, fight and bleed, feel lust and unrequited love, torture, hurt, and murder each other, drink alcohol and make-out, and occasionally use adult language. The violence, thematic material, sensuality, behavior, and language in Harry Potter never struck me as children's. What's more, it's a coming of age novel. The characters grow. The story is complex, dramatically gritty and true, and closer to reality than the typical "children's" fantasy is. It all locks in to a narrative that is detailed and fairly intelligent and professional. It is both stylish, mature, and cool, and quirky, quaint, and sometimes a little silly. But it's never overly ridiculous or childish. There is a limit to the type of drama and the things children's books can depict or imply, and Harry Potter shows very true, real, gritty human drama (with a cast of characters that are either teens or adults, and aren't children for the vast majority of the series,) as well as heavy descriptions and implications of violence, thematic content, and sensuality that goes beyond anything seen in a children's book. Harry has always been a very dark, mature character to me. You know the mental breakdown he has at the end of the 5th book? Some of the dark thoughts of murder he feels and expresses in the third book? His constant moments of depression from book 3 on? You will find nothing like that in a Children's book. Try to find me scenes as violent as the graveyard scene, the snake attack scene, Pettigrew's death/Hermione torture scene, the Sectumsempra scene, the entire Battle of Hogwarts scene, the Battle of the Astronomy tower, the Battle of the Department of Mysteries, George's injury, or Ron's injury scene, amongst others, in a children's book. Try to find me romantic relationships as realistic and deep as Tonks and Lupin, Harry and Ginny, Ron and Hermione, Bill and Fleur, even Lavender and Ron, Harry and Cho, and Hermione and Viktor in a children's book. Try to find me children's books with gritty human drama and darkly-depicted, deep, gritty themes that reflect genuine social and political issues (all things that Harry Potter does well) and then come talk to me.
Harry Potter is more adult than it is children's, actually.
The closest comparison I can think of is the His Dark Materials series. Which is YA. Just like Harry Potter.
Wikipedia lists the following genres for the Harry Potter series:
Fantasy, YOUNG ADULT FICTION, mystery, thriller, coming-of-age, (Bildungsroman) and magical realism, with elements of adventure, horror, and romance.
Also, a series with a predominantly tween/teen readership, a movie that had to be cut to avoid an R rating, as well as a predominantly PG-13 rated movie series, and a mainly teenage cast of characters, is not, under any circumstances, a children's series.
Short answer: It's Young Adult. Think The Hunger Games, Twilight, Divergent, etc.... I've always thought that was sort of obvious.