We have established an analytical model to investigate the bandgap energy of III-V and II-V semiconductor nanowires (NWs) by taking size and surface effect into account and found that there is a universal scaling of bandgap between bandgap energy Eg and structural factor K of NWs, Eg∼K−1, which meaning that the bandgap energy of semiconductor NWs usually increases with the structural factor decreasing. This scaling rule has a general insight into the basic physics involved in size effect of semiconductor NWs bandgap.