The insufficient bacteriostatic capacity of lignin greatly limits its application performance in the packaging and medical fields. Herein, a lignin with significantly enhanced antibacterial activity was prepared, in which PHGH (polyhexamethylene guanidine hydrochloride) was chosen to be grafted onto lignin, initiated by the glyoxal induced cross-linking. The grafting of PHGH on the lignin (PHGH-m-lignin) was confirmed by the FTIR, 1H- and 31P NMR spectra. The diameter size and zeta potential of PHGH-m-LNP were evaluated. Compared with that (199.96 nm) of pristine LNP, the diameter size of PHGH-m-LNP decreased to 71.44 nm, and the zeta potential increased to − 25.6 mV from − 30.1 mV. The results of antibacterial activity showed that the PHGH-m-LNP exhibited an excellent antibacterial activity (>99.99 %) towards E.coli. AFM images disclosed the physically antibacterial mechanism of PHGH-m-LNP. For the application, different concentrations of PHGH-m-lignin nanofiller (PHGH-m-LNP) were used to fabricate starch films via casting method. The PHGH-m-LNP could confer the starch film an exceptional antimicrobial activity (antibacterial activities = 98.84 %) at the addition level of 1 % (wt). In addition, the hydrophobicity and UV shielding capacity of starch film were enhanced, with the decreased maximum thermal degradation rate. Therefore, a new way to improve the antibacterial activity of lignin is provided, which is greatly significant for boosting the high-value application potential of lignin in the packaging and medical fields.