High-yield synthesis of g-C3N4 with a large surface area is achieved successfully. Generated NH3 and CO2 from urea act as the N-source and bubble-generating template. The BET and photocatalytic activity can be controlled by the bifunctional urea. The best sample CN-1.5 experts 10 times higher performance than the bulk g-C3N4. This simple method may open a new pathway for designing and optimizing of catalysts.