You might not have to smell sour milk for much longer.

The smart tags are gel-like in consistency but made out of tiny gold and silver particles called nanorods. American Chemical Society/YouTube

Chinese scientists have developed "smart tags" that stick to containers and change color when a food has gone bad. The gel-like tabs -- which are about the size of a corn kernel -- are safe and inexpensive, according to the creators, and could be stuck to cans and bottles to spot spoilage, even before the package is opened.

The scientists successfully tested the tags on milk, by exposing it to different temperatures and bacteria until it spoiled. They say tags can be customized to work on canned goods and even medication bottles.

"We successfully synchronized, at multiple temperatures, the chemical evolution process in the smart tag with microbial growth processes in the milk," lead researcher Dr. Chao Zhang, a scientist at Peking University in Beijjing, said in a statement.

Get Breaking News Delivered to Your Inbox

If a product was left out too long or stored improperly -- even if customers, grocery-store owners and manufacturers can't tell the difference without opening it and smelling it --"the tag still gives a reliable indication of the quality of the product," said Zhang.

How does it all work?

The tags are made of tiny compounds called nanorods that are made out of gold and silver, but only cost one-fifth of a penny each. The also contain vitamin C, acetic and lactic acids, and agar which react with nanorods to change their color. The tags the scientists designed appear red or reddish orange when 100-percent fresh, but over time, they change to orange, yellow and green, which means the food is 100-percent spoiled.

The gold nanorods are naturally red, and over time, the other compounds like silver gradually deposit onto the gold nanords, forming a silver shell layer that alters the shape and composition of the nanorods, a process that ultimately changes their color. This process is programmed to mimic the deterioration of foods based on expiration date, but also spoilage caused by temperature changes.

"Therefore, as the silver layer thickens over time, the tag color evolves from the initial red to orange, yellow, and green and even blue and violet," he explained.

The tags are programmed to change colors over the expiration cycle of a product, but can also react to temperatures. American Chemical Society/YouTube

Researchers took these tags and tested them using E. coli in milk, which created their reference model design.

If a carton of milk was expected to last for 14 days, for example, and the tag goes from red to orange, that would suggest there's only about 7 days left that the product is edible, he said.

The tags were unveiled March 17 at the American Chemical Society's National Meeting in Dallas, and preliminary research on their use was published last April in the society's journal ACS Nano.