National Center for Education Statistics
National Center for Education Statistics (NCES) conducts an annual survey of state education agencies to obtain data for every public elementary and secondary school in the United States and its territories, which it then compiles and publishes as the Common Core of Data Public Elementary/Secondary School Universe Survey (CCD). The CCD has two main purposes: 1) to provide an official listing of public elementary and secondary schools and school districts in the nation as a basis for samples for other NCES surveys; and 2) to provide basic descriptive statistics on public elementary and secondary schools. Mostly derived from administrative records, data cover school characteristics such as the school level, grades taught, student-teacher ratio, and federal Title I funding eligibility, and also provide information on enrolled student characteristics, including race/ethnicity, free/reduced price lunch eligibility, migrant status, and gender.
You can download the data here.