Walmart leads the way in generating solar energy from its store rooftops, creating 65,000 kilowatts from the sun — and leading a host of other corporate retailers.

Big-box retailers are often cast as the boogieman by environmentalists, but it’s these same retailers, lead by Walmart, that are leading the shift to solar power.

The installations of the top 20 corporate users of solar energy generate more than $47 million in electricity each year, according to a report by the Solar Energy Industries Association (SEIA). The top corporate users — including retailers such as Walmart, Costco, IKEA, Kohl’s, Macy’s and Staples — have installed enough photovoltaic (PV) systems to power more than 46,500 typical American homes. The top 10 companies have individually deployed more solar energy than most electric utilities in the U.S., according to the report.

“These companies know that solar energy allows them to reliably manage their long-term energy costs and in turn also helps to keep their customer prices low,” said SEIA President and CEO Rhone Resch. “Solar helps these top American companies focus on their core business by reducing overhead costs.”

Because of the sheer number of its stores, Walmart leads the pack by a wide margin, generating 65,000 kilowatts from the sun. Costco is a distant number two, generating 38,900 kilowatts.

Walmart has 115 rooftop solar installations in seven countries. Earlier this month, the company completed its largest solar project yet, installing 14,000 solar panels on a 1 million square-foot distribution center in Buckeye, a small town west of Phoenix. The panels sit atop the roof and parking canopies. The system will provide up to 30 percent of the center’s energy needs, generating enough electricity to power more than 400 homes. The reduction in greenhouse gas emissions is the equivalent of taking about 600 cars off the road.

Walmart is also looking to harness the power of the wind, installing micro-wind turbines in parking lots as part of an alternative energy test program.

The shift locks down a major contributor to operating costs and the falling cost of solar energy systems makes the economics even more appealing. The average price of a commercial photovoltaic system as dropped nearly 14 percent in the last year, according to the Solar Energy Industries Association. So companies focused on efficiency are more and more likely to look to the sun for a bargain.