The objective of the study was to investigate the effect of fortified diets with standard vs. high levels of vitamin B12 on cecal microbiota composition, production performance, and eggshell quality of laying hens. Dietary treatments consisted of a basal diet with no supplementation of vitamin B12 or supplemented with 25, 100, and 400 μg/kg vitamin B12, respectively. A total of 432 laying hens were randomly assigned to four treatments with six replicates per treatment. No significant effect of dietary treatments on the production performance of hens was detected. The shell thickness of eggs from hens fed diet supplemented with 100 μg/kg of vitamin B12 was higher (P < 0.01) than that of eggs from hens fed control diet or supplemented with 25 μg/kg vitamin B12. The shell percentage of eggs from hens fed diet supplemented with 400 μg/kg of vitamin B12 was higher (P < 0.01) than that of eggs from hens fed other treatment diets. Dietary vitamin B12 did not modulate diversity of the cecal microbiota of the layers. At genus level, the cecal content from layers fed diet with supplemental level of 100 or 400 μg/kg of vitamin B12 had higher (P < 0.01) abundance of Faecalibacterium and lower (P < 0.05) abundance of Acinetobacter compared with the cecal content from layers fed other two diets. The abundance of Lactobacillus in the cecal samples from layers fed 100 μg/kg of supplemental level of vitamin B12 was higher (P < 0.05) than that from layers fed other three diets. The abundance of Butyricicoccus was higher (P < 0.05), while Bilophila was lower (P < 0.05) in the cecal content of layers fed 400 μg/kg of vitamin B12 diet compared with those from layers fed other three diets. The results of PICRUSt analysis indicated that 10 predicted metabolic functions of the cecal microbial communities were positively correlated to dietary vitamin B12 level. Overall, dietary supplementation of 100 or 400 μg/kg of vitamin B12 had equivalent effects and caused the significant change in composition and metabolic functions of cecal microorganisms, which could positively impact eggshell quality, metabolism, and gut health of laying hens.