“We find, when we do our exit interviews, a lot of families are moving to surrounding communities where the cost of housing would be, and is, significantly less expensive,” Pierantozzi said. “Those school districts are probably demonstrating significant growth.”

Everett is among just over a dozen K-12 school districts north of Boston that have experienced a dramatic increase in student enrollment over the past decade, according to a Globe analysis of data from the state Department of Elementary and Secondary Education.

Since the 2002-2003 school year, Everett’s student population increased by 1,186, a 23.8 percent
spike. That is second to Winchester, which tops the list of communities north of Boston with a 25 percent increase in enrollment over the same period, the data show. Lynnfield, Revere, and Marblehead round out the top five gainers in the region.

But while some districts are figuring out ways to accommodate their growing enrollments, most are grappling with steep decreases attributed to everything from high housing prices to low birth rates.

Of the 42 K-12 school districts north of Boston, 28 — including Somerville — experienced decreases in student enrollment. Gloucester, where it has become harder to earn a living in the fishing industry, suffered the steepest drop, losing 28 percent of its students between the 2002-2003 and the 2012-2013 school years.

Next is Tewksbury, which saw its enrollment drop by 20.3 percent. Enrollment fell in Stoneham by 18.9 percent; Saugus by 17.7 percent; and Somerville by 16.1 percent. Statewide, enrollment declined 3.6 percent.

Most districts are equipped to handle minor enrollment fluctuations, but when the changes are rapid and dramatic, it can lead to problems: the loss of state aid, or being forced to build unplanned schools, said Jeff Wulfson, deputy commissioner for the Department of Elementary and Secondary Education.

“If enrollment decline extends over a number of years, over time it becomes hard to balance the budget,” Wulfson said. “Districts have to deal with cutting back [by way of] fewer buildings, fewer teachers, and that can be difficult.”

For districts with increasing enrollments, he said, “even though their state aid goes up, they still need school building assistance, and they’ll have to go through [property tax] overrides” to build new schools.

When it comes to the communities experiencing the most student gains, Winchester and Everett could not be more different, said Tim Reardon, manager of planning research for the Metropolitan Area Planning Council
.

Winchester has attracted an influx of young families able to afford the large homes vacated by empty-nesters, Reardon said. From 2000 to 2010, more than 800 children under the age of 10 moved to Winchester, according to the council’s analysis of population projections.

“It’s largely driven by the attractiveness of the school system and the quality of the community,” Reardon said. “It has a really good school system and for people who can afford it, they find it to be a nice place to live.”

In response to student growth, Winchester will open a larger incarnation of the Vinson-Owen Elementary School next month, with taxpayers covering $18 million of the $28 million cost and the state paying for the rest. The town also is exploring a $130 million renovation and expansion of Winchester High School, said Town Manager Richard Howard. If the high school project is approved by the state, the next step would be to persuade residents to agree to another temporary property tax increase, or debt exclusion, to fund it, he added.

“Some people see [a spike in student enrollment] as a little bit of a negative, but as a local public official, I don’t,” Howard said. “Having families with two or three children making use of your school system is obviously going to stress the budget for schooling, but it’s really the lifeblood of the community.”

Significant enrollment gains in Everett, a low-income community with a highly transient population because of its status as a gateway city for immigrants, are attributed to its high birth rate and plentiful, affordable housing stock, Reardon said. Between 2000 and 2010, approximately 6,000 children were born in Everett compared with about 2,400 in Winchester, said Reardon.

Everett anticipates enrolling 500 additional students within the next 30 days, said Thomas J. Stella, assistant school superintendent.

“We’re a high-poverty community,” Stella said. “One thing we’re exceptionally proud of is we have new schools, exceptional teachers, and no user fees for anything.”

Stella also credits the city’s proximity to Boston, Cambridge, and Somerville — and the fact that it is more affordable than any of those — for attracting new families. But the district’s relatively new or newly renovated school building stock may not be enough to keep up with the growing student population, he said.

“What will happen in the more immediate future is an increase in class size,” he said. “The average was 19 to 20 [students per classroom] and in the last couple of years it has crept up to 22 to 23. We expect it to go to 24 to 26. . . . We’ll need a new elementary school.”

On the opposite end of the spectrum is Gloucester, where US Census data show the population has dropped, from 30,273 in 2000 to an estimated 29,191
in 2012.

“It doesn’t have the fishing industry anymore, it’s not close to employment centers, it doesn’t attract young professionals, and it doesn’t have the school district that would attract young families,” Reardon said. “So they’re in a tough spot.”

While enrollment in Gloucester dropped 28 percent over the past 10 years, projections from the Massachusetts School Building Authority through 2017 indicate the downward trend will continue, albeit at a much slower rate, said Superintendent Richard Safier.

The district could lose just under 200 K-12 students by 2017, only 31 of those at the K-5 level, said Safier, adding that he does not consider that a crisis. Currently the district is working with the school building authority on a plan to replace the aging West Parish elementary school, a move that could persuade parents who currently send their kids to other communities by way of the School Choice
program to come back to Gloucester, he said.

Tewksbury Superintendent John E. O’Connor said the district responded to its enrollment dip by realigning schools in the 2009-2010 school year, going from four K-4 schools to two K-2 and two for grades 3 and 4.

O’Connor said the district has been impacted by a proliferation of choices for students, who can opt to go to technical, vocational, private, parochial, or charter schools. But for now, he does not see the need to close schools in the district.

“Our long-term outlook is to partner with the Massachusetts School Building Authority to look at building new schools in Tewksbury,” O’Connor said.

Statewide, the downward trend might have leveled off, said Wulfson, of the state education department.

“It looks like we just hit the low point,” he said. “It’s possible that the decline of the last decade is done.”

Katheleen Conti can be reached at kconti@globe.com. Globe Correspondent Shandana Mufti contributed to this report.