Tannic acid (TA) is one of the active components in the Galla Chinensis and has various effects, including antioxidant and anti-inflammatory properties. However, research on its antiviral properties remains limited. Here, tannic acid carbon dots (TA-CDs) were prepared as potential antiviral drugs from polyphenol TA under different temperature conditions (180, 200, 220 and 240 °C). Compared to TA alone, TA-CDs exhibited lower cytotoxicity and a tenfold enhanced in antiviral activity. Additionally, the antiviral effects of TA-CDs varied with preparation temperatures, with the best effect observed at 200 °C (CDs-2), reaching a titer of 2.8 orders of magnitude in porcine reproductive and respiratory syndrome virus (PRRSV), mainly due to its relatively higher number of functional groups and smaller particle size. Mechanically, CDs-2 was shown to inhibit PRRSV by targeting the stages of inactivation, adsorption, invasion, replication, and down-regulating reactive oxygen species (ROS) levels. Moreover, CDs-2 exhibited a high inhibitory effect on porcine epidemic diarrhea virus (PEDV), reaching a titer of 7 orders of magnitude. This study reveals the importance of temperature in synthesis of traditional Chinese medicine-derived carbon dots (TCM-CDs) and confirms their potential as antiviral drugs, providing valuable information for development of TCM antiviral drugs.