AgNPs@g-C3N4 composite was synthesized from Ag-containing sol and g-C3N4 powder by the ultrasonic-assisted self-assembly method. The composite has hierarchical pore size distributions, which will be beneficial to the ion transport with different size. Ag nanoparticles with the size of 5 nm successfully adhere on the surface of g-C3N4. The AgNPs@g-C3N4 composite has excellent specific capacitance and specific power performance for the supercapacitors as an electrode material. The specific capacitance of composite is 4 times greater than that of g-C3N4. It can be ascribed to the introduction of Ag nanoparticles that the internal resistance of the composite is significantly decreased.