Xylanase has been demonstrated to improve growth performance of broilers fed wheat- or corn-based diets due to its ability to degrade arabinoxylans (AX). However, content and structure of AX in corn and wheat are different, comparing effects of xylanase on cecal microbiota of broilers fed corn- or wheat-based diets could further elaborate the mechanism of the specificity of xylanase for different cereal grains. Thus, a total of 192 one-day-old broilers were randomly allotted into four dietary treatments, including wheat-soybean basal diet, wheat-soybean basal diet with 4,000U/kg xylanase, corn-soybean basal diet, and corn-soybean basal diet with 4,000U/kg xylanase to evaluate interactive effects of xylanase in corn- or wheat-based diets on broilers cecal microbiota during a 6-week production period. The results indicated that bacterial community clustering was mainly due to cereal grains rather than xylanase supplementation. Compared with broilers fed wheat-based diets, corn-based diets increased alpha-diversity and separated from wheat-based diets (p<0.05). Xylanase modulated the abundance of specific bacteria without changing overall microbial structure. In broilers fed wheat-based diets, xylanase increased the abundance of Lactobacillus, Bifidobacterium, and some butyrate-producing bacteria, and decreased the abundance of non-starch polysaccharides-degrading (NSP) bacteria, such as Ruminococcaceae and Bacteroidetes (p<0.05). In broilers fed corn-based diets, xylanase decreased the abundance of harmful bacteria (such as genus Faecalitalea and Escherichia-Shigella) and promoted the abundance of beneficial bacteria (such as Anaerofustis and Lachnospiraceae_UCG_010) in the cecum (p<0.05). Overall, xylanase supplementation to wheat- or corn-based diets improved broilers performance and cecal microbiota composition. Xylanase supplementation to wheat-based diets increased the abundance of butyrate-producing bacteria and decreased the abundance of NSP-degrading bacteria. Moreover, positive effects of xylanase on cecal microbiota of broilers fed corn-based diets were mostly related to the inhibition of potentially pathogenic bacteria, and xylanase supplementation to corn-based diets slightly affected the abundance of butyrate-producing bacteria and NSP-degrading bacterium, the difference might be related to lower content of AX in corn compared to wheat.