Abstract Windows are responsible for the largest amount of energy loss related to building envelope. Past studies on the energy consumption of windows have mainly focused on residential and commercial buildings, while few studies have explored the energy consumption of windows in educational buildings. The sizes and locations of classroom windows affect not only the building energy consumption but also the indoor environment quality, which is an issue that needs to be balanced. This paper takes a classroom in Guangzhou as the object. Under the premise of meeting the lighting standards of the classroom, two parameters—window height and sill height —were simulated in different corridors of north–south and east–west classrooms to analyse the impact of their changes on the indoor environment as well as energy consumption based on the parametric platform Grasshopper and its plug-ins Ladybug and Honeybee. The energy consumption of a number of fenestration combinations on both sides of the classroom was optimized automatically by genetic algorithm, and the sizes and positions of windows that benefitted energy savings were obtained. In the best case ~16.6% of energy consumed in a whole year can be saved compared with the worst case. This conclusion can provide a quick decision-making process for the design of window shapes for the purpose of energy savings in the early design stage of educational buildings in the Pearl River Delta such that energy savings can be quickly and clearly guaranteed in the subsequent window configuration.