Apple's supplier said on Saturday a number of its tools had been infected by a virus and the problem had been contained.
"TSMC has contained the problem and found a solution, and recovery of the tools is in progress," it said in a statement.
Some media outlets reported that the shutdowns were caused by a hacker attack on the plants' automated material handling systems.
However, "rumors of a hacker attack are incorrect," TSMC said in the statement.
The company said there was uneven impact across several of its fabs.
"The degree of infection varies by fab. Certain fabs returned to normal in a short period of time, and we expect the other fabs will return to normal in one day."
The company said that the computer virus outbreak will reduce its third quarter revenue by about 3%. It expects the incident to cause shipment delays and additional costs that will not only hurt its third quarter revenue, also reduce its third quarter gross margin by about 1%.
TSMC operates three 12-inch, four 8-inch and one 6-inch wafer plant in Taiwan, a 12-inch and an 8-inch plant in China, and an 8-inch plant in the US.
Three plants - Fab 12 at the Hsinchu Science Park, Fab 15 at the Central Taiwan Science Park and Fab 14 at the Southern Taiwan Science Park - came under attack by the virus, local media reported, citing industry sources.
TSMC last quarter began mass production of chips using the advanced 7-nanometer process technology mainly at Fab 15.
The company on July 19 said the 7-nanometer chips would account for 10 percent of its overall revenue this quarter, 20 percent next quarter and more than 20 percent next year.