Want teenagers to put down their gadgets and take a trip to the multiplex? Give them R-rated horror.

Then toss in a storyline about a misfit group of young teens banding together to battle bullies and the demonic Pennywise the Dancing Clown, and a bona fide blockbuster is born.

Those between the ages of 13 and 17 are a big part of why New Line and Warner Bros.' $30 million film adaptation of Steven King's novel It has become a box-office smash despite the restrictive rating (no one under the age of 17 can buy a ticket unless they are with a parent or guardian). In three weeks, It has amassed more than $480 million worldwide, including north of $266 million domestically, the fifth best showing of the year to date in North America and the top gross of all time for a horror title, not accounting for inflation.

During It's opening weekend, 15 percent of ticket buyers were between the ages of 13 and 17, according to comScore, which conducts polling in theaters across the country. The second weekend, that number jumped to 21 percent, by far the biggest growth spurt of any demo and an almost unheard-of-share for any movie these days, box-office analysts say.

Likewise, teens made up a significant share of New Line's Annabelle: Creation in the first two weekends — or 16 and 17 percent, respectively (Annabelle 2, still playing in theaters, has earned $295 million to date). Fellow New Line title The Conjuring 2 boasted nearly the same percentages in 2016. Overall, those between the ages of 12 and 17 made up 10 percent of all moviegoers in 2016, the smallest slice of any age group, according to the Motion Picture Association of America.

"Teens are fickle. Their tastes in music, clothing and entertainment change like the weather, and as elusive — and distracted — as they have been as an audience, horror has been and will remain the genre that pulls them to the multiplex like moths to a flame. The communal experience of the movie theater creates a bonding ritual among teens like no other, and when the movie has an R-rated sensibility with language and situations that resonate in a real world, and not in a condescending homogenized Hollywood way, teens respond," says comScore box-office analyst Paul Dergarabedian.

"The irony of It is that the 'forbidden fruit' nature of the film by virtue of the R rating amps up the cool factor and desirability among teen audiences who are technically too young to see the film without being accompanied by a parent or guardian. A further irony is that the kids in the Losers' Club and the actors who portray them would also not be able to buy a ticket on their own," he adds.

And he's right. Five of the lead actors — Jaeden Lieberher, Jeremy Ray Taylor, Jack Dylan Grazer, Finn Wolfhard and Wyatt Oleff, are 14, while Chosen Jacobs and Sophia Lillis are 15.

In terms of mainstream blockbusters, which are generally rated PG-13,11 percent of the moviegoers turning out for Rogue One: A Star Wars Story in December 2016 were ages 13-17. This summer, that same stat for Wonder Woman was 14 percent, and 13 percent for Guardians of the Galaxy Vol. 2.

Ask Hollywood film studio executives and they'll tell you that teens are a difficult demo to please with the passing of such YA franchises as Twilight and The Hunger Games.

Younger adults are also elusive. But R-rated horror pics are the major exception with both age groups, helping to explain why the genre is booming at the box office.

On It's first weekend, ticket buyers between the ages of 18 and 24 made up the biggest slice, or 33 percent, followed by the 25-34 age group at 29 percent.

All told, a stunning 77 percent of It's initial audience was under the age of 35. There was a steady decline after that: ages 35 to 44 (15 percent), 45 to 54 (7 percent) and 55-plus (2 percent). By the pic's second weekend, 79 percent of ticket buyers were under 35.

"There are so many forms of entertainment that are competing for teens and young adults’ attention that it’s important to connect emotionally with this audience. We're seeing that kind of reaction with It because audiences are applauding at the end of the film. Audiences don’t usually applaud at the end of a horror movie, but this is a different kind of horror movie," says Dan Lin, one of the producers of the movie. "It's a powerful coming-of-age movie that happens to be really scary, but with an ending that’s positive and inspiring."

Warner Bros. hasn't been deluged with complaints about so many teens going to see It. Ditto for the Motion Picture Association of America and the major theater circuits.

"This isn't a movie we've had parents complain about, which sometimes they do. It's not a slasher movie. It's a suspense thriller, and such a phenomenon. It really is getting a broad audience," says Warner Bros. domestic distribution president Jeff Goldstein. "It shocks you and makes you react."

Adds Dergarabedian: "Whether accompanied by their elders or not, there is no denying that on many levels this is the perfect movie for teens for whom the story is relatable on so many levels, and as we all know, when it comes to teens, if there's a way to get in to see this movie they will certainly find it."

A version of this story first appeared in the Sept. 27 issue of The Hollywood Reporter magazine. To receive the magazine, click here to subscribe.