Aerobic granular sludge (AGS) reactors are promising for treating high ammonia wastewaters, yet the roles of granules and flocs in nitrogen removal under varying carbon to nitrogen (COD/N) ratios remain unclear. This study investigated microbial communities and their contributions to N removal as the COD/N ratio shifted from 6 to 4, and to 2. Results showed granules contributed 53-64 % nitrification capacity at higher COD/N ratios (6 and 4), but flocs contributed more (50-63 %) at a ratio of 2. Granules consistently exhibited higher denitrification capacity (>
50 %). Heterotrophic bacteria dominated in both granules and flocs across all ratios. As the COD/N ratio reduced, the relative abundance of anaerobic ammonia oxidation microorganisms (Candidatus Anammoximicrobium) and filamentous bacteria increased in granules, while ammonia oxidizing bacteria (Nitrosomonas) and complex organic degraders increased in flocs. These findings highlight the importance of selectively retaining granules or flocs under varying COD/N ratios to optimize nitrogen removal efficiency.