Enrollment in Massachusetts public schools has declined as a result of the pandemic, with about 40,000 fewer students than last year in attendance — a 4% drop.

Among the losses, state education officials said more than 13,000 left for private schools, double the number a year ago. Homeschooling drew another 7,000 students out of public schools, a seven-fold increase over 2019.

Across the 400 districts in the state, another 7,000 students were unaccounted for, according to the Department of Elementary and Secondary Education.

Katherine Craven, chair of the state Elementary and Secondary Board of Education, expressed surprise when the numbers were revealed at its monthly meeting Tuesday.

"Wow ... There's a lot of food for thought here," she said.

Russell Johnston, the department's senior associate commissioner, said the 7,000 unlocated students could have left the country or not informed their school district of a their whereabouts as a result of the way the pandemic has upended many families. He did not disclose enrollment levels in individual districts, saying the department needed more time before releasing detailed data.

District enrollment is a factor in the state's educational funding formula. State officials have not publicly addressed how they will weigh the declines when allocating funds.

The statewide decrease is smaller than what was reported by the Massachusetts Association of School Superintendents earlier this month.

It has also spurred education advocates to ask for a different approach to funding next year. In Worcester, where public schools have reported declines the past two years, not everyone is convinced that COVID-19 is the reason the system lost 1,000 students this year. Seventy percent of that decrease came in pre-kindergarten and kindergarten classes, according to information provided by the district.

Statewide, pre-kindergarten and kindergarten enrollment fell 18% from 2019, compared to a 2.4% drop in grades 1-12.