New York City high schoolers used to pack heat as often as they packed lunch.

This month, more than 100,000 city public school kids walked out to protest gun violence — but last century some students attended class armed with their rifles and practiced shooting on school grounds.

Many of the city’s public high schools had shooting clubs and a few even had gun ranges on their premises, according to accounts from the Department of Education and others.

There were at least three shooting ranges in public schools, the DOE said, including Curtis HS on Staten Island and Erasmus Hall HS in Brooklyn.

Another inside Far Rockaway HS in Queens, which closed in 2011, is shown in a black-and-white archival photo from May 1929 displaying a compartmentalized gun range with at least five windows to shoot from and cranks for students to pull the targets back and forth.

“To accommodate the kids, they even made them these little pull-out benches they can kneel on to shoot from that position or even lie down to shoot,” said Darren Leung, owner of Westside Rifle & Pistol Range in Chelsea, describing the equipment seen in the 89-year-old photo. “What an excellent design.”

Shooting clubs were popular in many schools, even if they didn’t have gun ranges.

Members of the shooting club at Tottenville HS on Staten Island would bring their rifles to school, but the club would travel a few miles to Perth Amboy, NJ to practice, according to one alum who attended in the 1940s.

“Even in New York City, virtually every public high school had a shooting club up until 1969,” gun-rights advocate and academic John Lott Jr. wrote in his 2003 book, “The Bias Against Guns.”

“It was common for high school students to take their guns with them to school on the subways in the morning and turn them over to their home-room teacher or the gym coach so the heavy guns would simply be out of the way. After school, students would pick up their guns when it was time for practice.”

The DOE doesn’t know exactly how many shooting clubs or gun ranges city schools had or when they were shut down.

Officials said there aren’t any shooting clubs left and the ranges were repurposed decades ago.

“There are no active gun ranges in our schools and we do not centrally track school-based student clubs,” DOE spokesman Michael Aciman said.