Among all public services in this country, few are as uneven in quality as the American public education system. While schools must follow certain guidelines and are held to public standards, they are largely funded by property taxes — which means their budgets largely depend on neighborhood wealth rather than per student or by need.

A review of data on public high schools in the United States shows a substantial diversity in quality and educational outcomes between school districts.

21. Massachusetts
> High school: Massachusetts Academy of Math & Science
> Students: 97
> Student-teacher ratio: 13:1
> Average SAT: 1460

Across the country, just over 80% of students graduate, 4.9% of students enroll in Advanced Placement classes, and the average SAT score is a little over 1000 out of 1600. In some of the nation’s top public schools, virtually all students graduate, AP enrollment is well above 70%, and average SAT scores are above 1400.

While the nation’s top public high schools are primarily concentrated in a few of the the most populous states, including Illinois, New York, California, and Texas, every state in the country has at least one high school that exceeds national averages, and whose students are better set up for success. Based on publicly-available data on factors such as standardized test scores, student-teacher ratios, graduation rates, AP enrollment, and more, 24/7 Wall St. reviewed the top public high school in each state.

To determine the best public high school in every state, 24/7 Wall St. reviewed rankings for all public schools from school and neighborhood data clearinghouse Niche. Data on rank, number of students, student teacher ratio, average graduation rate, average SAT score, average ACT score, and AP enrollment also came from Niche. Data on the ratio of students to teachers by state came from the National Center for Education Statistics. Graduation rates by state also came from the NCED and are for the 2012-13 school year. Data on AP enrollment by state for the 2011-12 school year came from Civil Rights Data Collection.

Click here to see the best public high school in each state.