Retailers are typically obsessed with what to put under their roofs, not on them. Yet the nation’s biggest store chains are coming to see their immense, flat roofs as an untapped resource.

In recent months, chains including Wal-Mart Stores, Kohl’s, Safeway and Whole Foods Market have installed solar panels on roofs of their stores to generate electricity on a large scale. One reason they are racing is to beat a Dec. 31 deadline to gain tax advantages for these projects.

So far, most chains have outfitted fewer than 10 percent of their stores. Over the long run, assuming Congress renews a favorable tax provision and more states offer incentives, the chains promise a solar construction program that would ultimately put panels atop almost every big store in the country.

The trend, while not entirely new, is accelerating as the chains seize a chance to bolster their environmental credentials by cutting back on their use of electricity from coal.