The shiny new pair of Bose headphones you bought online just arrived in the mail. You break the seal of a huge corrugated cardboard box and tear through multiple layers of packaging. You immediately feel a pang of guilt. Could your Amazon addiction be bad for the environment?

You can rest easy. The carbon emissions linked to that cardboard box, and the freight truck it came in, are far less than that of hopping in your car and driving to the store. Unless, that is, the store is on your way to work or school. And if you got rush shipping, or decide to return them, the carbon emissions you saved revert back to zero.

Online shopping was once widely hailed as a greener alternative that would keep Americans off the roads. But this may not always be the case. Factors like the number of miles you drive, the number of products you buy, and whether you make a return or use rush shipping can tip the scale one way or another.

There’s plenty of research that says online shopping is the greener route, mainly because the UPS truck delivering your Bose headphones is going through less fuel per package than if you drove to the store yourself. One frequently cited 2009 study from Carnegie Mellon University’s Green Design Institute found that online retail not only uses less energy, but its carbon footprint is also a third smaller than that of brick-and-mortar retail.

Anotherpaper, from MIT in 2013, found that online shoppers who never set foot in a store have a carbon footprint almost two times smaller than a traditional shopper. Traditional shoppers may make multiple trips to the store to find out more about the product, compare prices, and eventually buy the product. Online shoppers, on the other hand, can do all of this without leaving their couches.

The existing research doesn’t take into account the Amazon Prime user who impulse-buys shoes, random books, and Keurig coffee pods.

But supply chain experts warn that such studies barely scratch the surface. The existing research doesn’t take into account the Amazon Prime user who impulse-buys shoes, random books, and Keurig coffee pods at least three times a week while living within walking distance of a Target. Or the rural shopper who drives 20 miles, round-trip, just to get to the grocery store.

And if you add rush shipping or an unanticipated return to the mix, the environmental gains from shopping online nearly return to zero.

Just last month, Simon Property Group, the largest mall landlord in the nation, released a study that concluded that online shopping actually has a 7 percent greater environmental impact than going to the store. But Patrick Penfield, a professor of supply chain practices at Syracuse University, cautions that the Simon study could be misleading. The study assumed that mall shoppers traveled in groups and combined shopping with other errands. “In reality, I don’t think this is what really happens with shopping,” Penfield said. For example, plenty of people go to the mall and don’t buy anything at all, and plenty of people return things they buy in-person.

“I think all those studies are right, and they are also wrong at the same time. The problem with this issue is that we are evolving. Online shopping is evolving. Consumer behavior is evolving,” said Miguel Jaller, an assistant professor of transportation engineering and supply chain management at the University of California, Davis. Meanwhile, Amazon and other online retailers constantly tweak their supply chains for greater efficiency. But they’re also offering faster delivery options that rely on air freight and emit more carbon.

As a general rule of thumb, if you need to buy several things, it’s better to go to the store.

According to Jaller, one of the negative consequences of rush delivery is the inability to consolidate. “You need to provide this level of service. You can’t wait for orders to come in at the same locations. You are rushing. In essence, that will increase the number of vehicle trips. That translates into more emissions,” said Jaller.

Online and traditional retailers have different supply chains, but the function is essentially the same. Retail stores order inventory from warehouses, which ship them goods by freight truck. In the early days of online shopping, your order would get delivered to you by freight truck directly from the warehouse or from the nearest Amazon fulfillment center. But in the case of Amazon Prime’s two-day shipping, your order could go from a fulfillment center to a “sortation center” to your nearest post office. Or it could get loaded on a plane.

As a general rule of thumb, if you need to buy several things, it’s better to go to the store. “I’m fairly positive that if I took one or two trips to Costco per month, it would be less of an environmental impact than constant Amazon Prime,” said Matthew Leighton, a life-cycle analyst. The environmental benefits of online shopping diminish as soon as you buy multiple items that can’t be bundled. If you need to buy more than 24 items, it’s better to go to the store. The environmental impact of buying 25 items in-store is roughly the same as buying a single item online, according to a studyin the International Journal of Physical Distribution & Logistics Management.

Jaller said that he thinks as consumer awareness increases, habits will change and corporations will respond. Many companies, including Amazon, have already adapted by offering store credit for customers who choose no-rush shipping options. Major online retailers such as J.Crew and L.L. Bean offer in-store returns.

“It’s so easy for us to buy online right now that we buy more than than we need,” said Jaller. “I think people will need to become really careful about what we buy in order to avoid a return. Finally, people need to understand that even though rush deliveries are kind of free right now, they have a toll on the environment.”