Mayor Bill de Blasio tends to err on the side of caution when it comes to cancelling school during winter storms.

Under him, snow days have become more common: He has declared five during his four years in office — the same number that his predecessor, Michael Bloomberg, ordered during his nearly 12 years as mayor, according to the city education department.

Some of that caution might stem from the time four years ago when he kept schools open before a severe winter storm — and faced a withering backlash.

And so when de Blasio saw that six to 10 inches of snow were expected to begin falling on Thursday just as children and teachers would be commuting to school, along with strong winds and freezing temperatures, he went with the safer course. At 6:36 p.m. Wednesday, he sent a tweet cancelling school.

“I felt very confident about the decision,” he told reporters Thursday, adding that he considers the safety of students and school workers, along with the needs of parents, when deciding whether to close schools during winter storms.

Schools will reopen Friday, the education department announced Thursday afternoon.

Whether to close schools is among the most difficult decisions a mayor must make when a snowstorm approaches. Doing so might deprive some of the city’s 1.1 million school children hot meals and put their working parents in a bind. But leaving them open could subject students and staffers to hazardous travel conditions and inevitably invites harsh criticism.

Bloomberg, notoriously stingy in declaring snow days, took heat both for keeping schools open and for closing them at the last minute. Eva Moskowitz, head of Success Academy Charter Schools, infuriated some parents last year when she kept her network of more than 40 schools open during a storm after the traditional schools had been closed. (Success schools were closed Thursday.)

De Blasio had his moment in February 2014 when, on a Wednesday night just six weeks after taking office, he and his schools chief, Carmen Fariña, announced that schools would remain open the following day despite a forecast of up to 10 inches of snow. The decision outraged parents and teachers who trudged through the snow the next morning only to find that fewer than half of students had made it to school. The blowback worsened after a defensive de Blasio questioned the National Weather Service’s forecasts (prompting angry tweets from the weatherman, Al Roker) and Fariña insisted the weather wasn’t all that bad.

“Clueless schools chief: ‘It’s a beautiful day’,” one headline blared about Fariña, who recently announced her retirement and did not attend the mayor’s press briefing Thursday.

After a different winter storm in 2014, Fariña explained the rationale for keeping schools open: In a system where most students come from working-class or poor families, many parents cannot afford to call off work or hire a babysitter when school is cancelled, while some students could go hungry.

“What about the kids for whom the schools is a safe haven?” she said. “Many of our kids would not have had a hot lunch today if the schools hadn’t been open.”

New York City schools serve between 860,000 and 1 million meals each day, according to the education department. This year, for the first time, school lunches are free for all students — not just those whose family income is low enough to qualify for subsidies. However, no meals are served on snow days.

Some parents say snow days can present a hardship.

Magdalena Garcia, who has two children who attend P.S. 241 STEM Institute of Manhattan, said she is not currently employed and was able to stay home with her children Thursday. But other parents she knows in her East Harlem neighborhood did not have that option.

“I hear them say, ‘I may just have to take my child to work,’” she said. “Because a lot of people can’t miss out on money — they won’t get paid if they don’t go.”

But many others would prefer to keep their children at home during a snowstorm.

Tanesha Grant, who lives in Washington Heights and has two children in city schools, said conditions were so perilous Thursday morning that she would have considered keeping her children home even if schools weren’t closed.

“My kids don’t miss any school,” she said. “But when it snows like this, the most important thing to me is my kids’ safety.”

Many educators agree. Not only do they fear for the safety of students who must travel to school during a storm, but many worry about making their own commutes under such conditions. And, if schools are left open despite severe weather, they know little will be accomplished.

“It never feels like a quality day of school because almost no one is there,” said Stacey Campo, the community-school director of P.S. 61 in the Bronx.

Still, even though she believes it’s almost always the right call to cancel school during a snowstorm, she knows it leaves some of her students in a tough spot.

“I always worry about our most vulnerable families,” she said.

Monica Disare, Christina Veiga, and Alex Zimmerman contributed reporting.