If you want your children to go to the best schools in the country, you may want to move to a small town near New York City or Philadelphia.
According to a recent study by Niche, a website that ranks more than 13,000 public school districts in the United States, six of the top 10 public school districts in the United States are in suburbs of New York City, with four in Westchester County alone. Three of the best school districts are in Pennsylvania, with an outlier district in upstate New York.
Niche compiles its list by assessing what it calls the "overall experience" at public schools throughout the country and in Puerto Rico. Data is sourced from government and public data (including test scores and financial documents). Additional data is collected by Niche and more than 4.6 million opinion-based survey responses from current students, recent alumni and parents.
According to Niche, high rankings indicate that students are happy with their schools in areas such as academics, teachers, health, safety, resources, facilities, extracurriculars, sports and fitness, and that district schools excel by providing stellar academic opportunities, learning resources, diversity and extracurriculars.
As Niche puts it, "A high ranking indicates that the district contains great schools with exceptional teachers, sufficient resources, and a diverse set of high-achieving students who rate their experiences very highly."
Not-so-coincidentally, all the districts listed in Niche's top 10 have nearly perfect ratings at GreatSchools.org, a site that rates schools based on how well their students perform on standardized tests.
The towns with the best schools all also feature open spaces, close proximity to a major metropolitan area and -- especially in the case of each of the New York City suburbs -- high home prices.
Click ahead for a look at these top 10 districts and how much it'll cost you to live there.
Chappaqua Central School District, New Castle Town, New York
Spending per student: $27,803
Median home value: $802,000
Located about 35 miles north of midtown Manhattan near the Hudson River, New Castle Town is an idyllic New York City suburb that includes the hamlets of Chappaqua and Millwood of Westchester. Despite its proximity to the city, the town is known for its rural feel, with large wooded areas and a downtown filled with small shops. The district has a GreatSchools rating of 10.
North Allegheny School District, McCandless Township, Pennsylvania
Spending per student: $14,144
Median home value: $206,200
The most affordable of all the districts in the top 10, McCandless Township is nestled among the northern hills of Allegheny County, about 12 miles from downtown Pittsburgh. Originally a farming town that grew with the rest of the Pittsburgh area during the 1890s oil boom, McCandless today is a suburb that maintains "the same comfortable environment of a bygone era," according to the town's website. The town is ranked 39th among CNN Money's 2015 list of best 100 places to live. The district has a GreatSchools rating of 9.
Rye City School District, Rye, New York
Spending per student: $21,974
Median home value: $1,726,400
Just over an hour commute to Manhattan on the New Haven line, upscale Rye, New York, is on the border between New York and Connecticut near the Long Island Sound. Technically the youngest city in New York State (it split from the town of Rye in 1942), Rye is a hotbed of American history. The city is also home to two National Historic Landmarks: Boston Post Road, the oldest thoroughfare in the country; and the boyhood home of founding father and first U.S. Chief Justice John Jay. The district has a GreatSchools rating of 9.
Pittsford Central School District, Pittsford Town, New York
Spending per student: $18,346
Median home value: $245,200
Hundreds of miles from both New York City and Philadelphia in upstate New York, Pittsford is the only district on the list not in a suburb of one of those cities, although it is considered a suburb of Rochester. Located near Lake Ontario and the Canadian border, Pittsford is located on the Erie Canal, with many of the quaint town's restaurants and shops built along the water. The district has a GreatSchools rating of 10.
Great Neck Union Free School District, North Hempstead Town, New York
Spending per student: $29,353
Median home value: $1,069,200
North Hempstead, New York, is an affluent suburb of New York City located between the Manhasset and Hempstead bays on Long Island, about 20 miles from midtown Manhattan. Great Neck, the northwestern collection of nine villages and hamlets in North Hempstead, is home to Long Island's largest employer, the North Shore-LIJ Health System, a network of 20 hospitals and several other medical facilities. The town has previously been ranked among CNN Money's best 100 places to live, although it didn't make the 2015 list. The district has a GreatSchools rating of 9.
Scarsdale Union Free School District, Scarsdale, New York
Spending per student: $27,594
Median home value: $978,400
Just down the road from Rye (No. 8 on the list) is Scarsdale, another wealthy suburb within an hour's commute to Manhattan. A report by the League of Women Voters of Scarsdale boasts that the area has been home to "distinguished scholars, authors and artists, university presidents, Nobel and Pulitzer prize winners, a U.S. Vice President, state legislators, members of Presidential cabinets, a New York State Governor, an astronaut, a New York State Commissioner of Education, and presidents of large corporations." The district has a GreatSchools rating of 10.
Lower Merion School District, Lower Merion Township, Pennsylvania
Spending per student: $25,764
Median home value: $275,100
Less than 15 miles from downtown Philadelphia, Lower Merion Township is a suburb of parks and playgrounds -- more than 25 facilities and 665 acres of swimming pools, picnic areas and nature. According to its website, the community is "characterized by a deep sense of civic pride and involvement," with more than a dozen business and civic associations. The district has a GreatSchools rating of 10.
Tredyffrin-Easttown School District, Tredyffrin Township, Pennsylvania
Spending per student: $16,180
Median home value: $475,900
Tredyffrin and Easttown are side-by-side suburban towns about 25 miles from Philadelphia. Settled in the late 17th century as part of land promised by William Penn to Welsh Quaker settlers, the towns include part of Valley Forge National Historical Park and its many Revolutionary War-related sites. The district has a GreatSchools rating of 10.
Jericho Union Free School District, Oyster Bay Town, New York
Spending per student: $34,007
Median home value: $734,600
Located about 30 miles from midtown Manhattan, Oyster Bay Town extends from the North Shore to the South Shore of Long Island in Nassau County. During his presidency, Theodore Roosevelt summered in this oasis, which features open spaces and a small-community feel despite its proximity to New York City. The district has a GreatSchools rating of 10.
Edgemont Union Free School District, Greenburgh, New York
Spending per student: $25,917
Median home value: $978,400
Yet another affluent Westchester County town outside New York City, Greenburgh is in the same zipcode as Scarsdale (No. 5) and within a few minutes' drive of Rye (No. 8) on the banks of the Hudson River. The town is home to the main offices of the massive Westchester Library System, as well as many parks, a large nature center, pools and ponds. Outdoor activities abound, and the town's easy commute to Manhattan makes it an ideal suburb for the city crowd. The district has a GreatSchools rating of 9.