According to McDonald's sustainability goals, the company plans to drop foam packaging globally by 2019.

The chain also said it will switch to packaging made from recycled materials in every location by 2020.

The changes are in response to environmental concerns, since foam packaging is hard to recycle.

If you order an extra-large soda at McDonald's, the fast-food giant might give you a foam cup to fill. But that's about to change.

By the end of 2018, McDonald's says it will ditch foam cold-beverage cups and trays in every location around the world. The company also plans to use 100% recycled fiber-based packaging globally by 2020. Fiber-based packaging currently makes up over half of all cups, wrappings, containers, and trays, according to McDonald's.

This is the first time McDonald's has committed to a strict deadline to drop foam materials, which represent 2% of its packaging.

In recent years, environmental groups and some customers have expressed concerns about the toll McDonald's single-use foam packaging takes on the environment, since it's nearly impossible to recycle.

According to a 2015 report by environmental NGOs As You Sow and the Natural Resources Defense Council, most large food brands are not doing much to address the issue. The report analyzed 47 food companies — including McDonald's, Burger King, and Domino's Pizza — based on what they call the "four pillars of packaging sustainability:" switching to reusable packaging; recycled content; recyclability and materials use; and boosting materials recycling. None of the 47 brands fulfilled all four pillars.

McDonald's initially made the foam-packaging announcement on its website in May 2016, and published a report that further outlined its sustainability goals.

In 1986, the company started serving burgers and chicken nuggets in foam "clamshells," but later dropped them in 1990. A year later, it switched to more environmentally friendly paper wrappings and containers in some locations.

The latest decision to stop using foam packaging could encourage other fast-food giants to do the same.