Tuning the bandgap of nanoporous graphene is desirable for applications such as the charge transport layer in organic-hybrid devices. The holy grail in the field is the ability to synthesize 2D nanoporous graphene with variable pore sizes, and hence tuneable band gaps. Herein, we demonstrate the on-surface synthesis of nanoporous graphene with variable bandgaps. Two types of nanoporous graphene were synthesized via hierarchical C-C coupling, and verified by low-temperature scanning tunneling microscopy and non-contact atomic force microscopy with CO-terminated tip. Nanoporous graphene-1 is non-planar, and nanoporous graphene-2 is a single-atom thick planar sheet. Scanning tunneling spectroscopy measurements reveal that nanoporous graphene-2 has a bandgap of 3.8 eV, while nanoporous graphene-1 has a larger bandgap of 5.0 eV. Corroborated by first-principles calculations, we propose that the large bandgap opening is governed by the confinement of π-electrons induced by pore generation or the non-planar structure, and can be explained by Clar sextet theory. Our finding shows that by introducing nanopores, semimetallic graphene is converted into semiconducting nanoporous graphene-2 or insulating wide-bandgap nanoporous graphene-1.