E-commerce may be revolutionizing the way we shop, but it’s also creating mountain loads of cardboard boxes.

Some retailers, including Richfield-based Best Buy Co. Inc., are investing in technology to reduce the extra packaging that sometimes overwhelms consumers and is beginning to strain the waste stream in many U.S. cities.

At Best Buy’s e-commerce and appliance warehouse in Compton, Calif., a machine near the loading docks builds custom-sized, ready-to ship boxes at a clip of up to 15 boxes per minute. The boxes can be made for video games, headphones, printers, iPad cases — anything less than 31 inches wide.

“Most people are shipping 40 percent air,” said Rob Bass, head of Best Buy’s supply chain operations. “It’s horrible for the environment, it fills up trucks and airplanes in useless fashion. With this, we have zero wasted space; no air pillows.”

At one end, long sheets of cardboard are threaded into the system. As products arrive down a conveyor, sensors measure their size. A packing slip gets inserted just before the cardboard gets cut and neatly folded around the item. The boxes are fastened with glue rather than tape, and the machine makes a perforated edge at one end to make it easier for customers to open.

No bubble wrap or extra padding.

“Many people don’t have a place to recycle, especially plastic,” Jordan Lewis, director of the Compton distribution center, said during a recent tour. “There are times you have a box that’s 10 times the size of actual product. Now we no longer have that.”

The technology, developed by Italian manufacturer CMC Machinery, is also used at Shutterfly’s warehouse in Shakopee.

Best Buy has also installed the system at its regional distribution center in Dinuba, Calif., and a new e-commerce facility in Piscataway, N.J. A soon-to-open facility serving the Chicago area also will employ the technology.

Officials said the system has reduced cardboard waste by 40% and freed up floor space and manpower for better uses. It also allows Best Buy warehouse workers to “cube out” the UPS trucks with more boxes, which creates a host of additional savings.

“You’re shipping less air, so you can fill up to the ceiling,” said Rhett Briggs, who oversees the e-commerce operations at the Compton facility. “You use fewer trailers and have more efficient fuel costs by reducing the number of trips a carrier has to make.”

With the rise of e-commerce, global package shipping volume has risen 48% over the past years, according to the technology company Pitney Bowes.

In the United States alone, more than 18 million packages a day get handled by UPS, FedEx and the United States Postal Service.

But consumers and curbside recycling efforts haven’t kept up with the pace. Research shows that more cardboard is ending up in landfills, particularly now that China no longer buys our corrugated boxes.

Many retailers are grappling with the packaging issue.

Amazon has a “Frustration-Free Packaging Program” in which it works with manufacturers worldwide to help them improve packaging and reduce waste throughout the supply chain.

Walmart has a “Sustainable Packaging Playbook” it uses to encourage its partners to think about designs that use recycled and recyclable materials while also protecting products as they get bounced around during transit.

LimeLoop, a California company, has developed a reusable plastic shipping package used by a handful of small, specialty retailers.

As Best Buy works to meet consumers’ need for speed, shipping and packaging will become an increasing part of its cost of doing business.

Best Buy’s online revenue has more than doubled in the past five years. Last year, digital sales hit $6.45 billion, compared with $3 billion in fiscal year 2014.

The company said investing in technology such as the customized box maker reduces costs and furthers its goals of reducing greenhouse gas emissions.

Best Buy, like almost every large corporation, has a sustainability plan to cut its carbon footprint. Barron’s in its 2019 rankings gave Best Buy its No. 1 spot.

In 2015, before the machines to custom make the boxes, Best Buy started a wide-scale campaign asking consumers to recycle its boxes — and all boxes. It printed messages on the boxes.

Now, the company is cutting the waste that needs to be recycled.